def test_get_balance_two_loonie_candy_75():
    """
    given that two toonies are inserted into the machine and a candy bar
     was purchased, the method should return 85.
    """
    machine = vending_machine.VendingMachine()
    toonie = coins.Toonie()
    candy = products.Candy()
    machine.insert_coin(toonie)
    machine.insert_coin(toonie)
    machine.buy_product(candy)
    assert machine.get_balance() == 85
def test_vending_machine_whole():
    """
    Here we do a integrated test to simulate a action of using vending machine
    """
    machine1 = vending_machine.VendingMachine()
    quarter = coins.Quarter()
    toonie = coins.Toonie()
    dime = coins.Dime()
    nickel = coins.Nickel()
    loonie = coins.Loonie()
    candy = products.Candy()
    chips = products.Chips()
    machine1.insert_coin(toonie)
    machine1.insert_coin(loonie)
    machine1.insert_coin(loonie)
    machine1.insert_coin(toonie)
    machine1.insert_coin(quarter)
    candy = products.Candy()
    chips = products.Chips()
    machine1.buy_product(candy)
    machine1.buy_product(chips)
    assert machine1.get_change() == [
        quarter, quarter, dime, dime, dime, nickel
    ]
Example #3
0
def test_candy_str():
    """test candy str"""
    candy = products.Candy()
    assert str(candy) == "Candy: $3.15"
Example #4
0
def test_candy_price():
    """test candy price"""
    candy = products.Candy()
    assert candy.price == 315
def test_candy_str():
    candy = products.Candy()
    assert str(candy) == 'Candy: $3.15'
def test_candy_price():
    candy = products.Candy()
    assert candy.price == 315