diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2018-08-15 11:36:44 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2018-08-15 12:00:26 +0800 |
commit | f513696c95789bcaea862cf98d239f1004609795 (patch) | |
tree | 6ddec3b13ddcc34136655b2de70b35be2f4253fd | |
parent | 9dc03c9f74a02423b88f424e962790681e7cf78b (diff) |
Add unit test for jobutil
Change-Id: I3f1e7833e7dc42d92a248d68e6717163043e3dd9
Issue-ID: VFC-1009
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/pub/utils/tests.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lcm/pub/utils/tests.py b/lcm/pub/utils/tests.py index 232acf05..09b135e5 100644 --- a/lcm/pub/utils/tests.py +++ b/lcm/pub/utils/tests.py @@ -18,7 +18,7 @@ import enumutil import fileutil import urllib2 -from lcm.pub.database.models import JobStatusModel +from lcm.pub.database.models import JobStatusModel, JobModel from lcm.pub.utils.jobutil import JobUtil @@ -85,3 +85,17 @@ class UtilsTest(unittest.TestCase): self.assertEqual(2, len(jobs)) self.assertEqual(3, jobs[0].indexid) self.assertEqual(2, jobs[1].indexid) + JobStatusModel.objects.filter().delete() + + def test_is_job_exists(self): + job_id = "1" + JobModel.objects.filter().delete() + JobModel( + jobid=job_id, + jobtype="1", + jobaction="2", + resid="3", + status=0 + ).save() + self.assertTrue(JobUtil.is_job_exists(job_id)) + JobModel.objects.filter().delete() |