fuel-library/deployment/puppet/osnailyfacter/spec/defines/osnailyfacter_mysql_grant_s...

84 lines
1.9 KiB
Ruby

require 'spec_helper'
describe 'osnailyfacter::mysql_grant' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '16.04',
:concat_basedir => '/var/lib/puppet/concat'
}
end
context 'with defaults' do
let(:title) { 'localhost' }
let(:params) do
{ :user => 'root' }
end
it 'should include mysql grant for localhost by default' do
is_expected.to contain_mysql_user('root@localhost').with(
:password_hash => ''
)
is_expected.to contain_mysql_grant('root@localhost/*.*').with(
:user => 'root@localhost',
:table => '*.*',
:options => ['GRANT'],
:privileges => ['ALL']
)
end
end
context 'with specific database and table' do
let(:title) { 'localhost' }
let(:params) do
{
:user => 'root',
:database => 'testing',
:table => 'testing'
}
end
it 'should include mysql grant for localhost by default' do
is_expected.to contain_mysql_user('root@localhost').with(
:password_hash => ''
)
is_expected.to contain_mysql_grant('root@localhost/testing.testing').with(
:user => 'root@localhost',
:table => 'testing.testing',
:options => ['GRANT'],
:privileges => ['ALL']
)
end
end
context 'with specific custom privileges' do
let(:title) { 'localhost' }
let(:params) do
{
:user => 'root',
:options => '',
:privileges => ['SELECT']
}
end
it 'should include mysql grant for localhost by default' do
is_expected.to contain_mysql_user('root@localhost').with(
:password_hash => ''
)
is_expected.to contain_mysql_grant('root@localhost/*.*').with(
:user => 'root@localhost',
:table => '*.*',
:options => '',
:privileges => ['SELECT']
)
end
end
end