def test_single_id(self): '''Test with singal plan id and tag id''' self.assertRaisesXmlrpcFault(INTERNAL_SERVER_ERROR, XmlrpcTestPlan.add_tag, self.http_req, self.plans[0].pk, self.tag1.pk) XmlrpcTestPlan.add_tag(self.http_req, self.plans[0].pk, self.tag1.name) tag_exists = TestPlan.objects.filter(pk=self.plans[0].pk, tag__pk=self.tag1.pk).exists() self.assert_(tag_exists)
def test_single_id(self): """Test with singal plan id and tag id""" self.assertXmlrpcFaultInternalServerError(XmlrpcTestPlan.add_tag, self.http_req, self.plans[0].pk, self.tag1.pk) XmlrpcTestPlan.add_tag(self.http_req, self.plans[0].pk, self.tag1.name) tag_exists = TestPlan.objects.filter(pk=self.plans[0].pk, tag__pk=self.tag1.pk).exists() self.assertTrue(tag_exists)
def test_array_argument(self): XmlrpcTestPlan.add_tag(self.http_req, self.plans[0].pk, [self.tag2.name, self.tag_name]) tag_exists = TestPlan.objects.filter(pk=self.plans[0].pk, tag__name__in=[self.tag2.name, self.tag_name]) self.assert_(tag_exists.exists()) plans_ids = [plan.pk for plan in self.plans] tags_names = [self.tag_name, 'xmlrpc_tag_name_2'] XmlrpcTestPlan.add_tag(self.http_req, plans_ids, tags_names) for plan in self.plans: tag_exists = plan.tag.filter(name__in=tags_names).exists() self.assert_(tag_exists)
def test_single_id(self): '''Test with singal plan id and tag id''' try: XmlrpcTestPlan.add_tag(self.http_req, self.plans[0].pk, self.tag1.pk) except Fault as e: self.assertEqual(e.faultCode, 500) else: self.fail('Argument tags accepts values of string and array ' + 'only. Passing a number should cause it fail.') XmlrpcTestPlan.add_tag(self.http_req, self.plans[0].pk, self.tag1.name) tag_exists = TestPlan.objects.filter(pk=self.plans[0].pk, tag__pk=self.tag1.pk).exists() self.assert_(tag_exists)