mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
bb0ed1a3a7
Defined "integration.run_tests()" function which can be used to execute a particular integration test case. Existing bolerplate code in modules and states tests is replaced with following lines: if __name__ == '__main__': from integration import run_tests run_tests(TestCaseName) Typical usecase could look like this: python integration/modules/pip.py --no-clean -vv
72 lines
2.0 KiB
Python
72 lines
2.0 KiB
Python
import integration
|
|
|
|
|
|
class AliasesTest(integration.ModuleCase):
|
|
'''
|
|
Validate aliases module
|
|
'''
|
|
def not_test_set_target(self):
|
|
'''
|
|
aliases.set_target and aliases.get_target
|
|
'''
|
|
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, 'target=bob')
|
|
|
|
def not_test_has_target(self):
|
|
'''
|
|
aliases.set_target and aliases.has_target
|
|
'''
|
|
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)
|
|
|
|
def not_test_list_aliases(self):
|
|
'''
|
|
aliases.list_aliases
|
|
'''
|
|
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('alias=fred', tgt_ret)
|
|
|
|
def test_rm_alias(self):
|
|
'''
|
|
aliases.rm_alias
|
|
'''
|
|
set_ret = self.run_function(
|
|
'aliases.set_target',
|
|
alias='frank',
|
|
target='greg')
|
|
self.assertTrue(set_ret)
|
|
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)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
from integration import run_tests
|
|
run_tests(AliasesTest)
|