def test_filter_plans(self): plans = XmlrpcTestPlan.filter(None, {'pk__in': [self.plan_1.pk, self.plan_2.pk]}) plan = plans[0] self.assertEqual(self.plan_1.name, plan['name']) self.assertEqual(self.plan_1.product_version.pk, plan['product_version_id']) self.assertEqual(self.plan_1.author.pk, plan['author_id']) self.assertEqual(2, len(plan['case'])) self.assertEqual([self.case_1.pk, self.case_2.pk], plan['case']) self.assertEqual(0, len(plans[1]['case']))
def test_filter_out_all_plans(self): plans_total = TestPlan.objects.all().count() self.assertEqual(plans_total, len(XmlrpcTestPlan.filter(None))) self.assertEqual(plans_total, len(XmlrpcTestPlan.filter(None, {})))