def test_404_when_plan_nonexistent(self): try: XmlrpcTestPlan.get_test_cases(self.http_req, 0) except Fault as e: self.assertEqual(404, e.faultCode) plan_id = TestPlan.objects.order_by('-pk')[:1][0].pk + 1 try: XmlrpcTestPlan.get_test_cases(self.http_req, plan_id) except Fault as e: self.assertEqual(404, e.faultCode)
def test_get_test_cases(self): serialized_cases = XmlrpcTestPlan.get_test_cases(self.http_req, self.plan.pk) for case in serialized_cases: expected_case = TestCase.objects.filter(plan=self.plan.pk).get(pk=case['case_id']) self.assertEqual(expected_case.summary, case['summary']) self.assertEqual(expected_case.priority_id, case['priority_id']) self.assertEqual(expected_case.author_id, case['author_id']) plan_case_rel = TestCasePlan.objects.get(plan=self.plan, case=case['case_id']) self.assertEqual(plan_case_rel.sortkey, case['sortkey'])
def test_plan_has_no_cases(self): result = XmlrpcTestPlan.get_test_cases(self.http_req, self.another_plan.pk) self.assertEqual([], result)
def test_different_argument_type(self): try: XmlrpcTestPlan.get_test_cases(self.http_req, str(self.plan.pk)) except Fault as e: self.assertEqual(400, e.faultCode)