X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=catalog%2Fjobs%2Ftests%2Ftests.py;h=9499cd036a11b8ad5fe1c9c355260874618ba413;hb=3d10bac5ec6b5394d32dc6ad3b0a7e6294ea6593;hp=460c85497e94d0d212e6cccb38af1639339a981f;hpb=a40cb469e3aa364fb2a0f016632bc642b4ecbdb7;p=modeling%2Fetsicatalog.git diff --git a/catalog/jobs/tests/tests.py b/catalog/jobs/tests/tests.py index 460c854..9499cd0 100644 --- a/catalog/jobs/tests/tests.py +++ b/catalog/jobs/tests/tests.py @@ -13,6 +13,7 @@ # limitations under the License. from django.test import TestCase, Client from rest_framework import status +from catalog.pub.utils.jobutil import JobUtil from catalog.pub.database.models import JobModel, JobStatusModel @@ -38,3 +39,23 @@ class JobsViewTest(TestCase): response = self.client.get("/api/catalog/v1/jobs/%s" % job_id) self.assertIn('jobId', response.data) self.assertNotIn('responseDescriptor', response.data) + + def test_job_normal_multijobstatus(self): + JobUtil.create_job( + inst_type='test_new_job_id', + jobaction='test_jobaction', + inst_id="test_jobinstid", + job_id=self.job_id) + response = self.client.post("/api/catalog/v1/jobs/%s" % self.job_id, {"progress": "10", "desc": "10%", "errcode": "true"}, + format='json') + print(response) + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) + response = self.client.post("/api/catalog/v1/jobs/%s" % self.job_id, {"progress": "50", "desc": "50%", "errcode": "true"}, + format='json') + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) + response = self.client.post("/api/catalog/v1/jobs/%s" % self.job_id, {"progress": "100", "desc": "100%", "errcode": "true"}, + format='json') + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) + response = self.client.get("/api/catalog/v1/jobs/%s" % self.job_id) + print(response) + self.assertEqual(status.HTTP_200_OK, response.status_code)