desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'publish.publish'
| def test_publish(self):
| ret = self.run_function('publish.publish', ['minion', 'test.ping'], f_timeout=50)
self.assertEqual(ret, {'minion': True})
ret = self.run_function('publish.publish', ['minion', 'test.kwarg'], f_arg='cheese=spam', f_timeout=50)
ret = ret['minion']
check_true = ('cheese', '__pub_arg', '__pub_fun', '__p... |
'test publish.publish yaml args formatting'
| def test_publish_yaml_args(self):
| ret = self.run_function('publish.publish', ['minion', 'test.ping'], f_timeout=50)
self.assertEqual(ret, {'minion': True})
test_args_list = ['saltines, si', 'crackers, nein', 'cheese, indeed']
test_args = '["{args[0]}", "{args[1]}", "{args[2]}"]'.format(args=test_args_list)
ret = self.... |
'publish.full_data'
| def test_full_data(self):
| ret = self.run_function('publish.full_data', ['minion', 'test.fib', 20], f_timeout=50)
self.assertTrue(ret)
self.assertEqual(ret['minion']['ret'][0], 6765)
|
'Verify that the pub data is making it to the minion functions'
| def test_kwarg(self):
| ret = self.run_function('publish.full_data', ['minion', 'test.kwarg'], f_arg='cheese=spam', f_timeout=50)
ret = ret['minion']['ret']
check_true = ('cheese', '__pub_arg', '__pub_fun', '__pub_id', '__pub_jid', '__pub_ret', '__pub_tgt', '__pub_tgt_type')
for name in check_true:
if (name not in ret)... |
'Test bad authentication'
| def test_reject_minion(self):
| ret = self.run_function('publish.publish', ['minion', 'cmd.run', ['echo foo']], f_timeout=50)
self.assertEqual(ret, {})
|
'aliases.set_target and aliases.get_target'
| def test_set_target(self):
| set_ret = self.run_function('aliases.set_target', alias='fred', target='bob')
self.assertTrue(set_ret)
tgt_ret = self.run_function('aliases.get_target', alias='fred')
self.assertEqual(tgt_ret, 'bob')
|
'aliases.set_target and aliases.has_target'
| def test_has_target(self):
| set_ret = self.run_function('aliases.set_target', alias='fred', target='bob')
self.assertTrue(set_ret)
tgt_ret = self.run_function('aliases.has_target', alias='fred', target='bob')
self.assertTrue(tgt_ret)
|
'aliases.list_aliases'
| def test_list_aliases(self):
| set_ret = self.run_function('aliases.set_target', alias='fred', target='bob')
self.assertTrue(set_ret)
tgt_ret = self.run_function('aliases.list_aliases')
self.assertIsInstance(tgt_ret, dict)
self.assertIn('fred', tgt_ret)
|
'aliases.rm_alias'
| def test_rm_alias(self):
| set_ret = self.run_function('aliases.set_target', alias='frank', target='greg')
self.assertTrue(set_ret)
self.run_function('aliases.rm_alias', alias='frank')
tgt_ret = self.run_function('aliases.list_aliases')
self.assertIsInstance(tgt_ret, dict)
self.assertNotIn('alias=frank', tgt_ret)
|
'test.ping'
| def test_ping(self):
| self.assertTrue(self.run_function('test.ping'))
|
'test.echo'
| def test_echo(self):
| self.assertEqual(self.run_function('test.echo', ['text']), 'text')
|
'test.version'
| def test_version(self):
| self.assertEqual(self.run_function('test.version'), salt.version.__saltstack_version__.string)
|
'test.conf_test'
| def test_conf_test(self):
| self.assertEqual(self.run_function('test.conf_test'), 'baz')
|
'test.get_opts'
| def test_get_opts(self):
| opts = salt.config.minion_config(self.get_config_file_path('minion'))
self.assertEqual(self.run_function('test.get_opts')['cachedir'], opts['cachedir'])
|
'test.cross_test'
| def test_cross_test(self):
| self.assertTrue(self.run_function('test.cross_test', ['test.ping']))
|
'test.fib'
| def test_fib(self):
| self.assertEqual(self.run_function('test.fib', ['20'])[0], 6765)
|
'test.collatz'
| def test_collatz(self):
| self.assertEqual(self.run_function('test.collatz', ['40'])[0][(-1)], 2)
|
'test.outputter'
| def test_outputter(self):
| self.assertEqual(self.run_function('test.outputter', ['text']), 'text')
|
'Get current settings'
| def setUp(self):
| if (not salt.utils.platform.is_darwin()):
self.skipTest('Test only available on macOS')
if (not salt.utils.path.which('pkgutil')):
self.skipTest('Test requires pkgutil binary')
|
'Reset to original settings'
| def tearDown(self):
| self.run_function('pkgutil.forget', ['org.macports.MacPorts'])
self.run_function('file.remove', ['/opt/local'])
|
'Test pkgutil.list'
| def test_list(self):
| self.assertIsInstance(self.run_function('pkgutil.list'), list)
self.assertIn('com.apple.pkg.BaseSystemResources', self.run_function('pkgutil.list'))
|
'Test pkgutil.is_installed'
| def test_is_installed(self):
| self.assertTrue(self.run_function('pkgutil.is_installed', ['com.apple.pkg.BaseSystemResources']))
self.assertFalse(self.run_function('pkgutil.is_installed', ['spongebob']))
|
'Test pkgutil.install
Test pkgutil.forget'
| @destructiveTest
def test_install_forget(self):
| self.assertFalse(self.run_function('pkgutil.is_installed', [TEST_PKG_NAME]))
self.run_function('cp.get_url', [TEST_PKG_URL, TEST_PKG])
self.assertTrue(self.run_function('pkgutil.install', [TEST_PKG, TEST_PKG_NAME]))
self.assertIn('Unsupported scheme', self.run_function('pkgutil.install', ['ftp://test... |
'Clear out the database'
| def _clear_db(self):
| self.run_function('data.clear')
|
'data.load
data.dump'
| def test_load_dump(self):
| self._clear_db()
self.assertTrue(self.run_function('data.dump', ['{"foo": "bar"}']))
self.assertEqual(self.run_function('data.load'), {'foo': 'bar'})
self._clear_db()
|
'data.get
data.update'
| def test_get_update(self):
| self._clear_db()
self.assertTrue(self.run_function('data.update', ['spam', 'eggs']))
self.assertEqual(self.run_function('data.get', ['spam']), 'eggs')
self.assertTrue(self.run_function('data.update', ['unladen', 'swallow']))
self.assertEqual(self.run_function('data.get', ['["spam", "unladen"]']),... |
'data.update
data.cas
data.get'
| def test_cas_update(self):
| self._clear_db()
self.assertTrue(self.run_function('data.update', ['spam', 'eggs']))
self.assertTrue(self.run_function('data.cas', ['spam', 'green', 'eggs']))
self.assertEqual(self.run_function('data.get', ['spam']), 'green')
|
'Tests the installation of packages'
| def test_brew_install(self):
| try:
self.run_function('pkg.install', [ADD_PKG])
pkg_list = self.run_function('pkg.list_pkgs')
try:
self.assertIn(ADD_PKG, pkg_list)
except AssertionError:
self.run_function('pkg.remove', [ADD_PKG])
raise
except CommandExecutionError:
s... |
'Tests the removal of packages'
| def test_remove(self):
| try:
self.run_function('pkg.install', [DEL_PKG])
pkg_list = self.run_function('pkg.list_pkgs')
if (DEL_PKG not in pkg_list):
self.run_function('pkg.install', [DEL_PKG])
self.skipTest('Failed to install a package to delete')
self.run_function(... |
'Test pkg.version for mac. Installs a package and then checks we can get
a version for the installed package.'
| def test_version(self):
| try:
self.run_function('pkg.install', [ADD_PKG])
pkg_list = self.run_function('pkg.list_pkgs')
version = self.run_function('pkg.version', [ADD_PKG])
try:
self.assertTrue(version, msg='version: {0} is empty, ... |
'Test pkg.latest_version:
- get the latest version available
- install the package
- get the latest version available
- check that the latest version is empty after installing it'
| def test_latest_version(self):
| try:
self.run_function('pkg.remove', [ADD_PKG])
uninstalled_latest = self.run_function('pkg.latest_version', [ADD_PKG])
self.run_function('pkg.install', [ADD_PKG])
installed_latest = self.run_function('pkg.latest_version', [ADD_PKG])
version = self.run_function('pkg.version',... |
'Integration test to ensure pkg.refresh_db works with brew'
| def test_refresh_db(self):
| refresh_brew = self.run_function('pkg.refresh_db')
self.assertTrue(refresh_brew)
|
'Test pkg.list_upgrades: data is in the form {\'name1\': \'version1\',
\'name2\': \'version2\', ... }'
| def test_list_upgrades(self):
| try:
upgrades = self.run_function('pkg.list_upgrades')
try:
self.assertTrue(isinstance(upgrades, dict))
if len(upgrades):
for name in upgrades:
self.assertTrue(isinstance(name, six.string_types))
self.assertTrue(isinstan... |
'Test pkg.info_installed: info returned has certain fields used by
mac_brew.latest_version'
| def test_info_installed(self):
| try:
self.run_function('pkg.install', [ADD_PKG])
info = self.run_function('pkg.info_installed', [ADD_PKG])
try:
self.assertTrue((ADD_PKG in info))
self.assertTrue(('versions' in info[ADD_PKG]))
self.assertTrue(('revision' in info[ADD_PKG]))
sel... |
'Clean up after tests'
| def tearDown(self):
| pkg_list = self.run_function('pkg.list_pkgs')
if (ADD_PKG in pkg_list):
self.run_function('pkg.remove', [ADD_PKG])
if (DEL_PKG in pkg_list):
self.run_function('pkg.remove', [DEL_PKG])
|
'Set up the ssh module tests'
| def setUp(self):
| if (not check_status()):
self.skipTest('External source, github.com is down')
super(SSHModuleTest, self).setUp()
if (not os.path.isdir(SUBSALT_DIR)):
os.makedirs(SUBSALT_DIR)
ssh_raw_path = os.path.join(FILES, 'ssh', 'raw')
with salt.utils.files.fopen(ssh_raw_path) as fd:... |
'Tear down the ssh module tests'
| def tearDown(self):
| if os.path.isdir(SUBSALT_DIR):
shutil.rmtree(SUBSALT_DIR)
super(SSHModuleTest, self).tearDown()
del self.key
|
'test ssh.auth_keys'
| def test_auth_keys(self):
| shutil.copyfile(os.path.join(FILES, 'ssh', 'authorized_keys'), AUTHORIZED_KEYS)
ret = self.run_function('ssh.auth_keys', ['root', AUTHORIZED_KEYS])
self.assertEqual(len(list(ret.items())), 1)
key_data = list(ret.items())[0][1]
try:
self.assertEqual(key_data['comment'], 'github.com')
... |
'test to make sure that bad key encoding types don\'t generate an
invalid key entry in authorized_keys'
| def test_bad_enctype(self):
| shutil.copyfile(os.path.join(FILES, 'ssh', 'authorized_badkeys'), AUTHORIZED_KEYS)
ret = self.run_function('ssh.auth_keys', ['root', AUTHORIZED_KEYS])
self.assertEqual(len(list(ret.items())), 0)
|
'Check that known host information is returned from ~/.ssh/config'
| def test_get_known_host(self):
| shutil.copyfile(os.path.join(FILES, 'ssh', 'known_hosts'), KNOWN_HOSTS)
arg = ['root', 'github.com']
kwargs = {'config': KNOWN_HOSTS}
ret = self.run_function('ssh.get_known_host', arg, **kwargs)
try:
self.assertEqual(ret['enc'], 'ssh-rsa')
self.assertEqual(ret['key'], self.key)
... |
'Check that known host information is returned from remote host'
| def test_recv_known_host(self):
| ret = self.run_function('ssh.recv_known_host', ['github.com'])
try:
self.assertNotEqual(ret, None)
self.assertEqual(ret['enc'], 'ssh-rsa')
self.assertEqual(ret['key'], self.key)
self.assertEqual(ret['fingerprint'], GITHUB_FINGERPRINT)
except AssertionError as exc:
rai... |
'Check known hosts by its fingerprint. File needs to be updated'
| def test_check_known_host_add(self):
| arg = ['root', 'github.com']
kwargs = {'fingerprint': GITHUB_FINGERPRINT, 'config': KNOWN_HOSTS}
ret = self.run_function('ssh.check_known_host', arg, **kwargs)
self.assertEqual(ret, 'add')
|
'ssh.check_known_host update verification'
| def test_check_known_host_update(self):
| shutil.copyfile(os.path.join(FILES, 'ssh', 'known_hosts'), KNOWN_HOSTS)
arg = ['root', 'github.com']
kwargs = {'config': KNOWN_HOSTS}
ret = self.run_function('ssh.check_known_host', arg, **dict(kwargs, fingerprint='aa:bb:cc:dd'))
self.assertEqual(ret, 'update')
ret = self.run_function('ssh.check... |
'Verify check_known_host_exists'
| def test_check_known_host_exists(self):
| shutil.copyfile(os.path.join(FILES, 'ssh', 'known_hosts'), KNOWN_HOSTS)
arg = ['root', 'github.com']
kwargs = {'config': KNOWN_HOSTS}
ret = self.run_function('ssh.check_known_host', arg, **dict(kwargs, fingerprint=GITHUB_FINGERPRINT))
self.assertEqual(ret, 'exists')
ret = self.run_function('ssh.... |
'ssh.rm_known_host'
| def test_rm_known_host(self):
| shutil.copyfile(os.path.join(FILES, 'ssh', 'known_hosts'), KNOWN_HOSTS)
arg = ['root', 'github.com']
kwargs = {'config': KNOWN_HOSTS, 'key': self.key}
ret = self.run_function('ssh.check_known_host', arg, **kwargs)
self.assertEqual(ret, 'exists')
self.run_function('ssh.rm_known_host', arg, config... |
'ssh.set_known_host'
| def test_set_known_host(self):
| ret = self.run_function('ssh.set_known_host', ['root', 'github.com'], config=KNOWN_HOSTS)
try:
self.assertEqual(ret['status'], 'updated')
self.assertEqual(ret['old'], None)
self.assertEqual(ret['new']['fingerprint'], GITHUB_FINGERPRINT)
except AssertionError as exc:
raise Ass... |
'Find out whether a user exists.'
| def test_user_exists(self):
| ret = self.run_function('rabbitmq.user_exists', ['null_user'])
self.assertEqual(ret, False)
|
'Clean out the hosts file'
| def __clean_hosts(self):
| shutil.copyfile(os.path.join(FILES, 'hosts'), HFN)
|
'Delete the tmp hosts file'
| def __clear_hosts(self):
| if os.path.isfile(HFN):
os.remove(HFN)
|
'Make sure the tmp hosts file is gone'
| def tearDown(self):
| self.__clear_hosts()
|
'hosts.list_hosts'
| def test_list_hosts(self):
| self.__clean_hosts()
hosts = self.run_function('hosts.list_hosts')
self.assertEqual(len(hosts), 10)
self.assertEqual(hosts['::1'], ['ip6-localhost', 'ip6-loopback'])
self.assertEqual(hosts['127.0.0.1'], ['localhost', 'myname'])
|
'hosts.list_hosts
without a hosts file'
| def test_list_hosts_nofile(self):
| if os.path.isfile(HFN):
os.remove(HFN)
hosts = self.run_function('hosts.list_hosts')
self.assertEqual(hosts, {})
|
'hosts.get_ip'
| def test_get_ip(self):
| self.__clean_hosts()
self.assertEqual(self.run_function('hosts.get_ip', ['myname']), '127.0.0.1')
self.assertEqual(self.run_function('hosts.get_ip', ['othername']), '')
self.__clear_hosts()
self.assertEqual(self.run_function('hosts.get_ip', ['othername']), '')
|
'hosts.get_alias'
| def test_get_alias(self):
| self.__clean_hosts()
self.assertEqual(self.run_function('hosts.get_alias', ['127.0.0.1']), ['localhost', 'myname'])
self.assertEqual(self.run_function('hosts.get_alias', ['127.0.0.2']), [])
self.__clear_hosts()
self.assertEqual(self.run_function('hosts.get_alias', ['127.0.0.1']), [])
|
'hosts.has_pair'
| def test_has_pair(self):
| self.__clean_hosts()
self.assertTrue(self.run_function('hosts.has_pair', ['127.0.0.1', 'myname']))
self.assertFalse(self.run_function('hosts.has_pair', ['127.0.0.1', 'othername']))
|
'hosts.set_hosts'
| def test_set_host(self):
| self.__clean_hosts()
self.assertTrue(self.run_function('hosts.set_host', ['192.168.1.123', 'newip']))
self.assertTrue(self.run_function('hosts.has_pair', ['192.168.1.123', 'newip']))
self.assertTrue(self.run_function('hosts.set_host', ['127.0.0.1', 'localhost']))
self.assertEqual(len(self.run_functi... |
'hosts.add_host'
| def test_add_host(self):
| self.__clean_hosts()
self.assertTrue(self.run_function('hosts.add_host', ['192.168.1.123', 'newip']))
self.assertTrue(self.run_function('hosts.has_pair', ['192.168.1.123', 'newip']))
self.assertEqual(len(self.run_function('hosts.list_hosts')), 11)
self.assertTrue(self.run_function('hosts.add_host', ... |
'Ensure that hosts.add_host isn\'t adding duplicates and that
it\'s formatting the output correctly'
| def test_add_host_formatting(self):
| self.__clear_hosts()
with salt.utils.files.fopen(HFN, 'w'):
pass
self.assertTrue(self.run_function('hosts.add_host', ['192.168.1.3', 'host3.fqdn.com']))
self.assertTrue(self.run_function('hosts.add_host', ['192.168.1.1', 'host1.fqdn.com']))
self.assertTrue(self.run_function('hosts.add_host',... |
'Get current state of the test service'
| def setUp(self):
| self.SERVICE_ENABLED = self.run_function('service.enabled', [self.SERVICE_NAME])
|
'Reset the test service to the original state'
| def tearDown(self):
| if self.SERVICE_ENABLED:
self.run_function('service.start', [self.SERVICE_NAME])
else:
self.run_function('service.stop', [self.SERVICE_NAME])
|
'Test service.show'
| def test_show(self):
| service_info = self.run_function('service.show', [self.SERVICE_NAME])
self.assertIsInstance(service_info, dict)
self.assertEqual(service_info['plist']['Label'], self.SERVICE_NAME)
self.assertIn('Service not found', self.run_function('service.show', ['spongebob']))
|
'Test service.launchctl'
| def test_launchctl(self):
| self.assertTrue(self.run_function('service.launchctl', ['error', 'bootstrap', 64]))
self.assertEqual(self.run_function('service.launchctl', ['error', 'bootstrap', 64], return_stdout=True), '64: unknown error code')
self.assertIn('Failed to error service', self.run_function('service.launchc... |
'Test service.list'
| def test_list(self):
| self.assertIn('PID', self.run_function('service.list'))
self.assertIn('{', self.run_function('service.list', ['com.apple.coreservicesd']))
self.assertIn('Service not found', self.run_function('service.list', ['spongebob']))
|
'Test service.enable'
| @destructiveTest
def test_enable(self):
| self.assertTrue(self.run_function('service.enable', [self.SERVICE_NAME]))
self.assertIn('Service not found', self.run_function('service.enable', ['spongebob']))
|
'Test service.disable'
| @destructiveTest
def test_disable(self):
| self.assertTrue(self.run_function('service.disable', [self.SERVICE_NAME]))
self.assertIn('Service not found', self.run_function('service.disable', ['spongebob']))
|
'Test service.start
Test service.stop
Test service.status'
| @destructiveTest
def test_start(self):
| self.assertTrue(self.run_function('service.start', [self.SERVICE_NAME]))
self.assertIn('Service not found', self.run_function('service.start', ['spongebob']))
|
'Test service.stop'
| @destructiveTest
def test_stop(self):
| self.assertTrue(self.run_function('service.stop', [self.SERVICE_NAME]))
self.assertIn('Service not found', self.run_function('service.stop', ['spongebob']))
|
'Test service.status'
| @destructiveTest
def test_status(self):
| self.assertTrue(self.run_function('service.start', [self.SERVICE_NAME]))
self.assertTrue(self.run_function('service.status', [self.SERVICE_NAME]).isdigit())
self.assertTrue(self.run_function('service.stop', [self.SERVICE_NAME]))
self.assertEqual('', self.run_function('service.status', [self.SERVICE_NAME... |
'Test service.available'
| def test_available(self):
| self.assertTrue(self.run_function('service.available', [self.SERVICE_NAME]))
self.assertFalse(self.run_function('service.available', ['spongebob']))
|
'Test service.missing'
| def test_missing(self):
| self.assertFalse(self.run_function('service.missing', [self.SERVICE_NAME]))
self.assertTrue(self.run_function('service.missing', ['spongebob']))
|
'Test service.enabled'
| @destructiveTest
def test_enabled(self):
| self.assertTrue(self.run_function('service.start', [self.SERVICE_NAME]))
self.assertTrue(self.run_function('service.enabled', [self.SERVICE_NAME]))
self.assertTrue(self.run_function('service.stop', [self.SERVICE_NAME]))
self.assertFalse(self.run_function('service.enabled', [self.SERVICE_NAME]))
self... |
'Test service.disabled'
| @destructiveTest
def test_disabled(self):
| SERVICE_NAME = 'com.apple.nfsd'
self.assertTrue(self.run_function('service.start', [SERVICE_NAME]))
self.assertFalse(self.run_function('service.disabled', [SERVICE_NAME]))
self.assertTrue(self.run_function('service.stop', [SERVICE_NAME]))
self.assertTrue(self.run_function('service.disabled', [SERVIC... |
'Test service.get_all'
| def test_get_all(self):
| services = self.run_function('service.get_all')
self.assertIsInstance(services, list)
self.assertIn(self.SERVICE_NAME, services)
|
'Test service.get_enabled'
| def test_get_enabled(self):
| services = self.run_function('service.get_enabled')
self.assertIsInstance(services, list)
self.assertIn('com.apple.coreservicesd', services)
|
'test mine.get and mine.update'
| def test_get(self):
| self.assertTrue(self.run_function('mine.update', minion_tgt='minion'))
self.assertTrue(self.run_function('mine.update', minion_tgt='sub_minion'))
self.assertTrue(self.run_function('mine.get', ['minion', 'test.ping']))
|
'test mine.send'
| def test_send(self):
| self.assertFalse(self.run_function('mine.send', ['foo.__spam_and_cheese']))
self.assertTrue(self.run_function('mine.send', ['grains.items'], minion_tgt='minion'))
self.assertTrue(self.run_function('mine.send', ['grains.items'], minion_tgt='sub_minion'))
ret = self.run_function('mine.get', ['sub_minion',... |
'Test mine.flush'
| def test_mine_flush(self):
| for minion_id in ('minion', 'sub_minion'):
self.assertTrue(self.run_function('mine.send', ['grains.items'], minion_tgt=minion_id))
time.sleep(1)
for minion_id in ('minion', 'sub_minion'):
ret = self.run_function('mine.get', [minion_id, 'grains.items'], minion_tgt=minion_id)
self.asse... |
'Test mine.delete'
| def test_mine_delete(self):
| self.assertTrue(self.run_function('mine.send', ['grains.items']))
self.assertTrue(self.run_function('mine.send', ['test.echo', 'foo']))
ret_grains = self.run_function('mine.get', ['minion', 'grains.items'])
self.assertEqual(ret_grains['minion']['id'], 'minion')
ret_echo = self.run_function('mine.get... |
'Create test file for testing extended attributes'
| def setUp(self):
| if (not salt.utils.platform.is_darwin()):
self.skipTest('Test only available on macOS')
if (not salt.utils.path.which('xattr')):
self.skipTest('Test requires xattr binary')
self.run_function('file.touch', [TEST_FILE])
|
'Clean up test file'
| def tearDown(self):
| if os.path.exists(TEST_FILE):
os.remove(TEST_FILE)
|
'Make sure there are no attributes'
| def test_list_no_xattr(self):
| self.assertTrue(self.run_function('xattr.clear', [TEST_FILE]))
self.assertEqual(self.run_function('xattr.list', [TEST_FILE]), {})
self.assertEqual(self.run_function('xattr.list', [NO_FILE]), 'ERROR: File not found: {0}'.format(NO_FILE))
|
'Write an attribute'
| def test_write(self):
| self.assertTrue(self.run_function('xattr.clear', [TEST_FILE]))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, 'spongebob', 'squarepants']))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, 'squidward', 'plankton']))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, '... |
'Test xattr.read'
| def test_read(self):
| self.assertTrue(self.run_function('xattr.clear', [TEST_FILE]))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, 'spongebob', 'squarepants']))
self.assertEqual(self.run_function('xattr.read', [TEST_FILE, 'spongebob']), 'squarepants')
self.assertEqual(self.run_function('xattr.read', [NO_FILE, ... |
'Test xattr.delete'
| def test_delete(self):
| self.assertTrue(self.run_function('xattr.clear', [TEST_FILE]))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, 'spongebob', 'squarepants']))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, 'squidward', 'plankton']))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, '... |
'Test xattr.clear'
| def test_clear(self):
| self.assertTrue(self.run_function('xattr.clear', [TEST_FILE]))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, 'spongebob', 'squarepants']))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, 'squidward', 'plankton']))
self.assertTrue(self.run_function('xattr.write', [TEST_FILE, '... |
'Test presence of MySQL server, enforce a root password'
| @destructiveTest
def setUp(self):
| super(MysqlModuleDbTest, self).setUp()
NO_MYSQL_SERVER = True
ret1 = self.run_state('cmd.run', name=(((('mysqladmin --host="localhost" -u ' + self.user) + ' flush-privileges password "') + self.password) + '"'))
ret2 = self.run_state('cmd.run', name=(((((('mysqladmin --host="localho... |
'Used in db testCase, create, check exists, check in list and removes.'
| def _db_creation_loop(self, db_name, returning_name, test_conn=False, **kwargs):
| ret = self.run_function('mysql.db_create', name=db_name, **kwargs)
self.assertEqual(True, ret, "Problem while creating db for db name: '{0}'".format(db_name))
ret = self.run_function('mysql.db_exists', name=db_name, **kwargs)
self.assertEqual(True, ret, "Problem while testing ... |
'Create database, test presence, then drop db. All theses with complex names.'
| @destructiveTest
def test_database_creation_level1(self):
| db_name = 'foo 1'
self._db_creation_loop(db_name=db_name, returning_name=db_name, test_conn=True, connection_user=self.user, connection_pass=self.password)
ret = self.run_function('mysql.db_create', name='foo`2', character_set='utf8', collate='utf8_general_ci', connection_user=self.user, connection_pass=... |
'Play with the \'%\' character problems
This character should be escaped in the form \'%%\' on queries, but only
when theses queries have arguments. It is also a special character
in LIKE SQL queries. Finally it is used to indicate query arguments.'
| @destructiveTest
def test_mysql_dbname_character_percent(self):
| db_name1 = 'foo%1_'
db_name2 = 'foo%12'
ret = self.run_function('mysql.db_create', name=db_name1, character_set='utf8', collate='utf8_general_ci', connection_user=self.user, connection_pass=self.password)
self.assertEqual(True, ret)
ret = self.run_function('mysql.db_create', name=db_name2, connectio... |
'Test support of utf8 in database names'
| @destructiveTest
def test_database_creation_utf8(self):
| db_name_unicode = u'notam\xe9rican'
db_name_utf8 = 'notam\xc3\xa9rican'
self._db_creation_loop(db_name=db_name_utf8, returning_name=db_name_utf8, test_conn=False, connection_user=self.user, connection_pass=self.password, connection_charset='utf8', saltenv={'LC_ALL': 'en_US.utf8'})
self._db_creation_loop... |
'Test maintenance operations on a created database'
| @destructiveTest
def test_database_maintenance(self):
| dbname = u'foo%\'-- `"\''
ret = self.run_function('mysql.db_remove', name=dbname, connection_user=self.user, connection_pass=self.password)
ret = self.run_function('mysql.db_create', name=dbname, character_set='utf8', collate='utf8_general_ci', connection_user=self.user, connection_pass=self.password)
... |
'Test presence of MySQL server, enforce a root password'
| @destructiveTest
def setUp(self):
| super(MysqlModuleUserTest, self).setUp()
NO_MYSQL_SERVER = True
ret1 = self.run_state('cmd.run', name=(((('mysqladmin --host="localhost" -u ' + self.user) + ' flush-privileges password "') + self.password) + '"'))
ret2 = self.run_state('cmd.run', name=(((((('mysqladmin --host="local... |
'Perform some tests around creation of the given user'
| def _userCreationLoop(self, uname, host, password=None, new_password=None, new_password_hash=None, **kwargs):
| ret = self.run_function('mysql.user_remove', user=uname, host=host, **kwargs)
ret = self.run_function('mysql.user_create', user=uname, host=host, password=password, **kwargs)
self.assertEqual(True, ret, "Calling user_create on user '{0}' did not return True: {1}".format(uname, rep... |
'Internal routine to check user_info returned results'
| def _chck_userinfo(self, user, host, check_user, check_hash):
| ret = self.run_function('mysql.user_info', user=user, host=host, connection_user=self.user, connection_pass=self.password, connection_charset='utf8', saltenv={'LC_ALL': 'en_US.utf8'})
if (not isinstance(ret, dict)):
raise AssertionError("Unexpected result while retrieving user_info for ... |
'Internal routine to check user_remove'
| def _chk_remove_user(self, user, host, **kwargs):
| ret = self.run_function('mysql.user_remove', user=user, host=host, **kwargs)
self.assertEqual(True, ret, "Assertion failed while removing user '{0}' on host '{1}': {2}".format(user, host, repr(ret)))
|
'Test various users creation settings'
| @destructiveTest
def test_user_management(self):
| user1 = "user '1"
user1_pwd = 'pwd`\'"1b'
user1_pwd_hash = '*4DF33B3B12E43384677050A818327877FAB2F4BA'
user2 = 'user "2\'\xe6\xa8\x99'
user2_pwd = 'user "2\'\xe6\xa8\x99b'
user2_pwd_hash = '*3A38A7B94B024B983687BB9B44FB60B7AA38FE61'
user3 = 'user "3;,?:@=&/'
user3_pwd = 'user... |
'Test presence of MySQL server, enforce a root password, create users'
| @destructiveTest
def setUp(self):
| super(MysqlModuleUserGrantTest, self).setUp()
NO_MYSQL_SERVER = True
ret1 = self.run_state('cmd.run', name=(((('mysqladmin --host="localhost" -u ' + self.user) + ' flush-privileges password "') + self.password) + '"'))
ret2 = self.run_state('cmd.run', name=(((((('mysqladmin --host="... |
'Removes created users and db'
| @destructiveTest
def tearDown(self):
| for (user, userdef) in six.iteritems(self.users):
self._userRemoval(uname=userdef['name'], password=userdef['pwd'])
self.run_function('mysql.db_remove', name=self.testdb1, connection_user=self.user, connection_pass=self.password)
self.run_function('mysql.db_remove', name=self.testdb2, connection_use... |
'Create a test user'
| def _userCreation(self, uname, password=None):
| self.run_function('mysql.user_create', user=uname, host='localhost', password=password, connection_user=self.user, connection_pass=self.password, connection_charset='utf8', saltenv={'LC_ALL': 'en_US.utf8'})
|
'Removes a test user'
| def _userRemoval(self, uname, password=None):
| self.run_function('mysql.user_remove', user=uname, host='localhost', connection_user=self.user, connection_pass=self.password, connection_charset='utf8', saltenv={'LC_ALL': 'en_US.utf8'})
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.