コード例 #1
0
def test_create_soda_machine_with_invalid_params(drink_name, amount, price):
    with pytest.raises(Exception):
        SodaMachine.start([(drink_name, amount, price)])
コード例 #2
0
def soda_machine():
    return SodaMachine.start([("Coke", 10, 10)], "visa_server", "username",
                             "password")
コード例 #3
0
def test_create_soda_machine():
    machine = SodaMachine.start([("Coke", 10, 10)], "visa_server", "username",
                                "password")
    assert "Coke" in machine.drinks, "Coke is missing in machine"
    assert machine.drinks["Coke"].price == 10, "Wrong price was set to Coke"
    assert machine.drinks["Coke"].amount == 10, "Wrong amount was set to Coke"