def test_ids_in_array(self): self.assertRaisesXmlrpcFault(BAD_REQUEST, XmlrpcTestPlan.add_component, self.http_req, [1, 2]) plans_ids = [plan.pk for plan in self.plans] components_ids = [self.component1.pk, self.component2.pk] XmlrpcTestPlan.add_component(self.http_req, plans_ids, components_ids) for plan in TestPlan.objects.filter(pk__in=plans_ids): components_ids = [item.pk for item in plan.component.iterator()] self.assertTrue(self.component1.pk in components_ids) self.assertTrue(self.component2.pk in components_ids)
def test_ids_in_array(self): try: XmlrpcTestPlan.add_component(self.http_req, [1,2]) except Fault as e: self.assertEqual(e.faultCode, 400) plans_ids = [plan.pk for plan in self.plans] components_ids = [self.component1.pk, self.component2.pk] XmlrpcTestPlan.add_component(self.http_req, plans_ids, components_ids) for plan in TestPlan.objects.filter(pk__in=plans_ids): components_ids = [item.pk for item in plan.component.iterator()] self.assert_(self.component1.pk in components_ids) self.assert_(self.component2.pk in components_ids)
def test_ids_in_array(self): try: XmlrpcTestPlan.add_component(self.http_req, [1, 2]) except Fault as e: self.assertEqual(e.faultCode, 400) plans_ids = [plan.pk for plan in self.plans] components_ids = [self.component1.pk, self.component2.pk] XmlrpcTestPlan.add_component(self.http_req, plans_ids, components_ids) for plan in TestPlan.objects.filter(pk__in=plans_ids): components_ids = [item.pk for item in plan.component.iterator()] self.assert_(self.component1.pk in components_ids) self.assert_(self.component2.pk in components_ids)
def test_single_id(self): XmlrpcTestPlan.add_component(self.http_req, self.plans[0].pk, self.component1.pk) component_exists = TestPlan.objects.filter( pk=self.plans[0].pk, component__pk=self.component1.pk).exists() self.assertTrue(component_exists)