def test_build_get_empty(self): object_name = "TestCase" methods = [("get", {"pk": 1})] query = build_query(object_name, methods) self.assertEquals(query, None)
def test_build_get(self): testcase = store.TestCase.objects.create(name="test1", parent=self.root, status=self.status) object_name = "TestCase" methods = [("get", {"pk": testcase.pk})] query = build_query(object_name, methods) self.assertEquals(query, testcase)
def test_build(self): testcase = store.TestCase.objects.create(name="test", parent=self.root, status=self.status) object_name = "TestCase" methods = [("all", {})] query = build_query(object_name, methods) self.assertTrue(isinstance(query, QuerySet)) self.assertTrue(testcase in query)
def test_build_exclude(self): testcase1 = store.TestCase.objects.create(name="test1", parent=self.root, status=self.status) testcase2 = store.TestCase.objects.create(name="test2", parent=self.root, status=self.status) object_name = "TestCase" methods = [("all", {}), ("exclude", {"pk": testcase1.pk})] query = build_query(object_name, methods) self.assertTrue(isinstance(query, QuerySet)) self.assertTrue(testcase2 in query)