Aviv Keshet | 5ab8b69 | 2013-05-07 14:03:14 -0700 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | #pylint: disable-msg=C0111 |
| 3 | import unittest |
| 4 | import common |
| 5 | #pylint: disable-msg=W0611 |
| 6 | from autotest_lib.frontend import setup_django_lite_environment |
| 7 | from autotest_lib.frontend.afe import direct_afe |
| 8 | |
| 9 | |
| 10 | class DirectAFETest(unittest.TestCase): |
| 11 | def testEntryCreation(self): |
| 12 | afe = direct_afe.directAFE() |
| 13 | |
| 14 | jobs = afe.get_jobs() |
| 15 | self.assertEquals(len(jobs), 0) |
| 16 | |
| 17 | hosts = afe.get_hosts() |
| 18 | self.assertEquals(len(hosts), 0) |
| 19 | |
| 20 | afe.create_host('a_host') |
| 21 | hosts = afe.get_hosts() |
| 22 | self.assertEquals(len(hosts), 1) |
| 23 | |
| 24 | afe.create_job('job_name', hosts=['a_host']) |
| 25 | jobs = afe.get_jobs() |
| 26 | self.assertEquals(len(jobs), 1) |
| 27 | |
| 28 | if __name__ == '__main__': |
| 29 | unittest.main() |