blob: 7094881908ddcfb846b55e5265187b43d0f4295e [file] [log] [blame]
showarded2afea2009-07-07 20:54:07 +00001#!/usr/bin/python
2
3import unittest
4import common
5from autotest_lib.frontend import setup_django_environment
6from autotest_lib.frontend.afe import frontend_test_utils
7from autotest_lib.frontend.afe import models
8
9class SpecialTaskUnittest(unittest.TestCase,
10 frontend_test_utils.FrontendTestMixin):
11 def setUp(self):
12 self._frontend_common_setup()
13
14
15 def tearDown(self):
16 self._frontend_common_teardown()
17
18
showardc0ac3a72009-07-08 21:14:45 +000019 def _create_task(self):
20 return models.SpecialTask.objects.create(
showarded2afea2009-07-07 20:54:07 +000021 host=self.hosts[0], task=models.SpecialTask.Task.VERIFY)
22
showardc0ac3a72009-07-08 21:14:45 +000023
24 def test_execution_path(self):
25 task = self._create_task()
showarded2afea2009-07-07 20:54:07 +000026 self.assertEquals(task.execution_path(), 'hosts/host1/1-verify')
27
28
showardc0ac3a72009-07-08 21:14:45 +000029 def test_status(self):
30 task = self._create_task()
31 self.assertEquals(task.status, 'Queued')
32
33 task.update_object(is_active=True)
34 self.assertEquals(task.status, 'Running')
35
36 task.update_object(is_active=False, is_complete=True)
37 self.assertEquals(task.status, 'Completed')
38
39
showarded2afea2009-07-07 20:54:07 +000040if __name__ == '__main__':
41 unittest.main()