import pytest
from Invoice import Invoice


@pytest.fixture()
def products():
    products = {'Pen':
                    {'qnt': 10,
                     'unit_price': 3.75,
                     'discount': 5},
                'Notebook':
                    {'qnt': 5,
                     'unit_price': 7.5,
                     'discount': 10}}
    return products

@pytest.fixture()
def invoice():
    invoice = Invoice()
    return invoice

def test_CanFindInvoiceClass(invoice, products):
    invoice.totalImpurePrice(products)
    assert invoice.totalImpurePrice(products) == 75

def test_CanCalucateTotalDiscount(invoice, products):
    invoice.totalDiscount(products)
    assert invoice.totalDiscount(products) == 5.62

def test_CanCalucateTotalPurePrice(invoice, products):
    invoice.totalPurePrice(products)
    assert invoice.totalPurePrice(products) == 69.38


######## New test cases:
def test_CanCalucateTotalQnt(invoice, products):
    invoice.totalQnt(products)
    assert invoice.totalQnt(products) == 15

def test_ProductQuantityHasNoZeroValue(invoice, products):
    invoice.ProductQuantityHasNoZeroValue(products)
    assert invoice.ProductQuantityHasNoZeroValue(products) == True

def test_ProductUnitPriceHasNoZeroValue(invoice, products):
    invoice.ProductUnitPriceHasNoZeroValue(products)
    assert invoice.ProductUnitPriceHasNoZeroValue(products) == True

def test_ProductDiscountHasNoZeroValue(invoice, products):
    invoice.ProductDiscountHasNoZeroValue(products)
    assert invoice.ProductDiscountHasNoZeroValue(products) == True
