mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +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
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
import integration
|
|
|
|
|
|
class DiskModuleTest(integration.ModuleCase):
|
|
'''
|
|
Validate the disk module
|
|
'''
|
|
def test_usage(self):
|
|
'''
|
|
disk.usage
|
|
'''
|
|
ret = self.run_function('disk.usage')
|
|
self.assertTrue(isinstance(ret, dict))
|
|
if not isinstance(ret, dict):
|
|
return
|
|
for key, val in ret.items():
|
|
self.assertTrue('filesystem' in val)
|
|
self.assertTrue('1K-blocks' in val)
|
|
self.assertTrue('used' in val)
|
|
self.assertTrue('available' in val)
|
|
self.assertTrue('capacity' in val)
|
|
|
|
def test_inodeusage(self):
|
|
'''
|
|
disk.inodeusage
|
|
'''
|
|
ret = self.run_function('disk.inodeusage')
|
|
self.assertTrue(isinstance(ret, dict))
|
|
if not isinstance(ret, dict):
|
|
return
|
|
for key, val in ret.items():
|
|
self.assertTrue('inodes' in val)
|
|
self.assertTrue('used' in val)
|
|
self.assertTrue('free' in val)
|
|
self.assertTrue('use' in val)
|
|
self.assertTrue('filesystem' in val)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
from integration import run_tests
|
|
run_tests(DiskModuleTest)
|