コード例 #1
0
    def test_nonexisting_product(self):
        # given
        url = '/producten/product/wi193679/'

        # then
        with self.assertRaises(appiepy.ProductNotFoundException) as context:
            # when
            product = appiepy.Product(url)
コード例 #2
0
    def test_nutrition_parsed(self):
        # given
        url = '/producten/product/wi496941/princes-tonijnstukken-in-water'

        # when
        product = appiepy.Product(url)

        # then
        self.assertIsInstance(product.nutrition, dict)
コード例 #3
0
    def test_ingredients_parsed(self):
        # given
        url = '/producten/product/wi193679/lay-s-paprika'

        # when
        product = appiepy.Product(url)

        # then
        self.assertIsInstance(product.ingredients, list)
コード例 #4
0
    def test_allergy_parsed(self):
        # given
        url = '/producten/product/wi33693/ah-halfvolle-melk'

        # when
        product = appiepy.Product(url)

        # then
        self.assertIsInstance(product.allergy, list)
コード例 #5
0
ファイル: __init__.py プロジェクト: Arjanpeace/AppiePy
    def test_url_path(self):
        # given
        url = '/producten/product/wi395948/ah-kleintje-spinazie'
        # when
        product = appiepy.Product(url)

        # then
        self.assertEqual(product.url, url)
        self.assertIsInstance(product.id, str)
        self.assertIsInstance(product.brand, str)
        self.assertIsInstance(product.description, str)
        self.assertIsInstance(product.summary, str)
        self.assertIsInstance(product.unit_size, str)
        self.assertIsInstance(product.category, str)
        self.assertIsInstance(product.is_available, bool)
        self.assertIsInstance(product.price_current, float)
        self.assertIsInstance(product.is_discounted, bool)
        self.assertIsInstance(product.features, list)
        self.assertIsInstance(product.nutrition, dict)