Esempio n. 1
0
def test__apply_discount_on_price_with_nonexistant_value():
    discount = Discount(data=DISCOUNT_DATA)
    discount_value = 10
    price = 200
    item = {'article_id': 8, 'type': 'nonexistant', 'value': discount_value}

    assert discount._apply_discount_on_price(discount=item, price=price)\
        == price
Esempio n. 2
0
def test__apply_discount_on_price_with_percentage_value():
    discount = Discount(data=DISCOUNT_DATA)
    discount_value = 10
    price = 200
    item = {'article_id': 8, 'type': 'percentage', 'value': discount_value}

    assert discount._apply_discount_on_price(discount=item, price=price)\
        == (price - price * discount_value / 100)