forked from kushaldas/tunirtests
/
cloudservice.py
41 lines (30 loc) · 1.2 KB
/
cloudservice.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
From https://fedoraproject.org/wiki/QA:Testcase_base_service_manipulation.
"""
import unittest
from testutils import system
class TestServiceManipulation(unittest.TestCase):
def test_service(self):
"Tests the crond service."
out, err, eid = system('systemctl status crond.service')
self.assertIn('inactive', out)
system('systemctl start crond.service')
out, err, eid = system('systemctl status crond.service')
self.assertIn('disabled', out)
system('systemctl stop crond.service')
out, err, eid = system('systemctl status crond.service')
self.assertIn('inactive', out)
system('systemctl enable crond.service')
class TestServiceAfter(unittest.TestCase):
def test_service(self):
"Tests the crond service."
out, err, eid = system('systemctl status crond.service')
self.assertIn('active (running)', out)
system('systemctl disable crond.service')
class TestServiceFinal(unittest.TestCase):
def test_service(self):
"Tests the crond service."
out, err, eid = system('systemctl status crond.service')
self.assertIn('disabled', out)
if __name__ == '__main__':
unittest.main()