示例#1
0
    def test_flush_garden_and_trees_with_one_garden(self):
        g = create_garden()

        self.assertEqual(Garden.objects.all().count(), 1)
        self.assertEqual(FoodTree.objects.all().count(), 0)

        ajax_import.flush_gardens_and_trees()

        self.assertEqual(Garden.objects.all().count(), 0)
        self.assertEqual(FoodTree.objects.all().count(), 0)
示例#2
0
    def test_flush_garden_and_trees_with_one_garden(self):
        g = create_garden()

        self.assertEqual(Garden.objects.all().count(), 1)
        self.assertEqual(FoodTree.objects.all().count(), 0)

        ajax_import.flush_gardens_and_trees()

        self.assertEqual(Garden.objects.all().count(), 0)
        self.assertEqual(FoodTree.objects.all().count(), 0)
示例#3
0
    def test_flush_garden_and_trees_with_many_gardens_and_trees(self):
        create_garden()

        g = create_garden()
        create_food_tree(g)

        g = create_garden()
        create_food_tree(g)
        create_food_tree(g)
        create_food_tree(g)

        self.assertEqual(Garden.objects.all().count(), 3)
        self.assertEqual(FoodTree.objects.all().count(), 4)

        ajax_import.flush_gardens_and_trees()

        self.assertEqual(Garden.objects.all().count(), 0)
        self.assertEqual(FoodTree.objects.all().count(), 0)
示例#4
0
    def test_flush_garden_and_trees_with_many_gardens_and_trees(self):
        create_garden()

        g = create_garden()
        create_food_tree(g)

        g = create_garden()
        create_food_tree(g)
        create_food_tree(g)
        create_food_tree(g)

        self.assertEqual(Garden.objects.all().count(), 3)
        self.assertEqual(FoodTree.objects.all().count(), 4)

        ajax_import.flush_gardens_and_trees()

        self.assertEqual(Garden.objects.all().count(), 0)
        self.assertEqual(FoodTree.objects.all().count(), 0)