Exemplo n.º 1
0
    def test_get_substitute(self) -> None:
        """Test the correct substitute retrieval.
        """

        product_code: str = "3068320115161"
        expected_code_substitute: str = "3068320115161"
        category: Category = Category.objects.create(name="Boissons")
        for product in Config.PRODUCT_AND_SUBSTITUTE_DATA["product"]:
            Product.objects.create(**product)
            category.products.add(product["code"])
        substitute: Product = Product.get_substitute(
            product_code, product["nutriscore_grade"])
        assert substitute[0].code == expected_code_substitute