diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2018-08-15 15:09:20 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2018-08-15 15:09:20 +0800 |
commit | 4a341d9ebef0e5b9578db6af80c9b2c489bd0850 (patch) | |
tree | f76cdb8876af5535174f7adbbe7403ccea09cba1 | |
parent | f513696c95789bcaea862cf98d239f1004609795 (diff) |
Add unit test for jobutil
Change-Id: Iafa98d951f177a93050f1ca0caff56549f59c0e2
Issue-ID: VFC-1009
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/pub/utils/tests.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lcm/pub/utils/tests.py b/lcm/pub/utils/tests.py index 09b135e5..76cbfff0 100644 --- a/lcm/pub/utils/tests.py +++ b/lcm/pub/utils/tests.py @@ -99,3 +99,29 @@ class UtilsTest(unittest.TestCase): ).save() self.assertTrue(JobUtil.is_job_exists(job_id)) JobModel.objects.filter().delete() + + def test_create_job(self): + job_id = "5" + JobModel.objects.filter().delete() + JobUtil.create_job( + inst_type="1", + jobaction="2", + inst_id="3", + user="4", + job_id=5, + res_name="6") + self.assertEqual(1, len(JobModel.objects.filter(jobid=job_id))) + JobModel.objects.filter().delete() + + def test_clear_job(self): + job_id = "1" + JobModel.objects.filter().delete() + JobModel( + jobid=job_id, + jobtype="1", + jobaction="2", + resid="3", + status=0 + ).save() + JobUtil.clear_job(job_id) + self.assertEqual(0, len(JobModel.objects.filter(jobid=job_id))) |