Esempio n. 1
0
 def test_no_full_info_6(self):
     aliment = {
         "product_name_fr": 'test',
         "nutrition_grade_fr": 't',
         "ingredients_text_fr": 'test',
         "url": 'test',
     }
     assert fill.Command()._no_full_info(aliment) == True
Esempio n. 2
0
 def test_no_full_info_3(self):
     aliment = {
         "product_name_fr": 'test',
         "ingredients_text_fr": 'test',
         "url": 'test',
         "image_url": 'test'
     }
     assert fill.Command()._no_full_info(aliment) == True
Esempio n. 3
0
 def test_no_full_info_4(self):
     aliment = {
         "product_name_fr": 'test',
         "nutrition_grade_fr": 't',
         "url": 'test',
         "image_url": 'test'
     }
     assert fill.Command()._no_full_info(aliment) == True
Esempio n. 4
0
 def test_no_full_info_2(self):
     aliment = {
         "nutrition_grade_fr": 't',
         "ingredients_text_fr": 'test',
         "url": 'test',
         "image_url": 'test'
     }
     assert fill.Command()._no_full_info(aliment) == True
Esempio n. 5
0
 def test_redundant_info_6(self):
     aliment = {
         "product_name_fr": 'another_test',
         "nutrition_grade_fr": 't',
         "ingredients_text_fr": 'test',
         "url": 'test',
         "image_url": 'test'
     }
     assert fill.Command()._redundant_info(aliment, self.cat_test) == False
Esempio n. 6
0
 def test_save_1(self):
     aliment = {
         "product_name_fr": 'another_test',
         "nutrition_grade_fr": 't',
         "ingredients_text_fr": 'test',
         "url": 'test',
         "image_url": 'test'
     }
     counter = 0
     save_counter = fill.Command()._save(aliment, self.cat_test, counter)
     assert save_counter == counter + 1
Esempio n. 7
0
 def test_redundant_info_5(self):
     al = Aliment.objects.create(name='another_test',
                                 nutriscore='f',
                                 cat_name=self.cat_test,
                                 link='',
                                 image='')
     al.save()
     aliment = {
         "product_name_fr": 'another_test',
         "nutrition_grade_fr": 't',
         "ingredients_text_fr": '',
         "url": 'test',
         "image_url": 'test'
     }
     assert fill.Command()._redundant_info(aliment, self.cat_test) == True
Esempio n. 8
0
    def test_save_2(self):
        aliment = {
            "product_name_fr": 'another_test',
            "nutrition_grade_fr": 't',
            "ingredients_text_fr": 'test',
            "url": 'test',
            "image_url": 'test'
        }
        counter = 0
        _ = fill.Command()._save(aliment, self.cat_test, counter)

        test_save = Aliment.objects.get(name='another_test')
        test_save = {
            "product_name_fr": test_save.name,
            "nutrition_grade_fr": test_save.nutriscore,
            "ingredients_text_fr": test_save.ingredients,
            "url": test_save.link,
            "image_url": test_save.image
        }
        assert aliment == test_save
Esempio n. 9
0
 def test_verify_basic_categories(self):
     fill.Command()._verify_basic_categories()
     test_verify = Category.objects.filter(name="pizzas")
     assert test_verify.exists()
Esempio n. 10
0
 def test_add_categories(self):
     fill.Command().add_category("another_cat_test")
     test_add = Category.objects.filter(name="another_cat_test")
     assert test_add.exists()