aboutsummaryrefslogtreecommitdiff
path: root/frontend/afe/direct_afe_unittest.py
blob: e6c96fa8388ff7d9fa072a914b8b4f3855dfd977 (plain)
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
#!/usr/bin/python2
#pylint: disable-msg=C0111
import unittest
import common
#pylint: disable-msg=W0611
from autotest_lib.frontend import setup_django_lite_environment
from autotest_lib.frontend.afe import direct_afe


class DirectAFETest(unittest.TestCase):
    def testEntryCreation(self):
        afe = direct_afe.directAFE()

        jobs = afe.get_jobs()
        self.assertEquals(len(jobs), 0)

        hosts = afe.get_hosts()
        self.assertEquals(len(hosts), 0)

        afe.create_host('a_host')
        hosts = afe.get_hosts()
        self.assertEquals(len(hosts), 1)

        afe.create_job('job_name', hosts=['a_host'])
        jobs = afe.get_jobs()
        self.assertEquals(len(jobs), 1)

if __name__ == '__main__':
    unittest.main()