Пример #1
0
 def test_partial_update_rfe(self):
     rfe = factories.RFEFactory()
     self.assertNotEqual("updated", rfe.name)
     request = self.client.patch("/api/rfes/%s" % rfe.id,
                                 {"name": "updated"})
     self.assertEqual(200, request.status_code)
     rfe_updated = models.RFE.objects.get(id=rfe.id)
     self.assertEqual("updated", rfe_updated.name)
Пример #2
0
    def test_get_product_with_rfes_and_inheritance(self):
        osp12 = factories.ProductFactory(name="OSP12")
        osp13 = factories.ProductFactory(name="OSP13", inherit=osp12)
        osp14 = factories.ProductFactory(name="OSP14", inherit=osp13)
        rfe = factories.RFEFactory(product=osp12)

        request = self.client.get("/api/products/%s" % osp14.id)
        rfe_returned = request.data["rfes"][0]
        self.assertEqual(rfe.id, rfe_returned["id"])
        self.assertEqual(osp12.id, rfe_returned["product_id"])
Пример #3
0
 def test_update_rfe(self):
     rfe = factories.RFEFactory()
     self.assertNotEqual("updated", rfe.name)
     request = self.client.put(
         "/api/rfes/%s" % rfe.id,
         {
             "name": "updated",
             "url": rfe.url,
             "product": rfe.product.id
         },
     )
     self.assertEqual(200, request.status_code)
     rfe_updated = models.RFE.objects.get(id=rfe.id)
     self.assertEqual("updated", rfe_updated.name)
Пример #4
0
 def test_upload(self):
     xmlfile = open(
         os.path.join(os.path.dirname(__file__),
                      "tempest-results-full.1.xml"))
     product = factories.ProductFactory()
     test = factories.TestFactory(
         name=
         "tempest.api.compute.admin.test_simple_tenant_usage_negative.TenantUsagesNegativeTestJSON.test_get_usage_tenant_with_empty_tenant_id"
     )
     rfe = factories.RFEFactory(product=product, tests=[test])
     response = self.client.post(
         "/api/upload",
         {
             "product": product.id,
             "url": "https://example.org/jobs/1",
             "build": "2018-06-20.1",
             "file": xmlfile,
             "result": "SUCCESS",
         },
         format="multipart",
     )
     self.assertEqual(201, response.status_code)
     test = models.Test.objects.get(
         name=
         "tempest.api.compute.admin.test_simple_tenant_usage_negative.TenantUsagesNegativeTestJSON.test_get_usage_tenant_with_empty_tenant_id"
     )
     job_result = models.JobResult.objects.get(
         build="2018-06-20.1",
         url="https://example.org/jobs/1",
         product=product.id)
     self.assertEquals(job_result.jobname, "jobs")
     test_result = models.TestResult.objects.get(test=test,
                                                 job_result=job_result)
     self.assertTrue(test_result.result)
     rfe_result = models.RFEResult.objects.get(rfe=rfe)
     self.assertTrue(rfe_result.result)
     self.assertEquals(rfe_result.percent, 100.00)
Пример #5
0
 def test_upload(self):
     product = factories.ProductFactory()
     test = factories.TestFactory(name=TEST_NAME)
     rfe = factories.RFEFactory(product=product, tests=[test])
     test = models.Test.objects.get(name=TEST_NAME)
     self.upload_file(product, "tempest-results-full.1.xml")
     job_result = models.JobResult.objects.get(
         build="2018-06-20.1",
         url="https://example.org/jobs/1",
         product=product.id)
     self.assertEquals(job_result.jobname, "jobs")
     test_result = models.TestResult.objects.get(test=test,
                                                 job_result=job_result)
     self.assertTrue(test_result.result)
     rfe_result = models.RFEResult.objects.get(rfe=rfe)
     self.assertTrue(rfe_result.result)
     self.assertEquals(rfe_result.percent, 100.00)
     nb = models.TestResult.objects.filter(job_result=job_result).count()
     # change in tempest-results-full.2.xml is one test is failing
     self.upload_file(product, "tempest-results-full.2.xml")
     nb_job_result = models.JobResult.objects.all().count()
     self.assertEquals(nb_job_result, 1)
     nb2 = models.TestResult.objects.filter(job_result=job_result).count()
     self.assertEquals(nb, nb2)
Пример #6
0
 def test_delete_rfe(self):
     rfe = factories.RFEFactory()
     self.assertEqual(1, models.RFE.objects.all().count())
     request = self.client.delete("/api/rfes/%s" % rfe.id)
     self.assertEqual(204, request.status_code)
     self.assertEqual(0, models.RFE.objects.all().count())
Пример #7
0
 def test_rfe_factory(self):
     rfe = factories.RFEFactory(name="factory")
     self.assertEqual(rfe.name, "factory")
Пример #8
0
 def test_get_rfe(self):
     rfe = factories.RFEFactory()
     request = self.client.get("/api/rfes/%s" % rfe.id)
     self.assertEqual(rfe.name, request.data["name"])
Пример #9
0
 def test_get_rfes(self):
     rfe = factories.RFEFactory()
     request = self.client.get("/api/rfes")
     self.assertEqual(1, len(request.data))
     self.assertEqual(rfe.name, request.data[0]["name"])