def test_travel_room_price_set_wrong_type(default_travel: Travel): """ Test case for incorrect Travel.hotel_price method use TEST CASE: Calling hotel_price method to set non float hotel price. EXPECTED BEHAVIOUR: The method raise a TypeError exception because the price is non float. """ with pytest.raises(TypeError): default_travel.hotel_price = 5
def test_travel_set_negative_value_to_room_property(default_travel: Travel): """ Test case for incorrect Travel.hotel_price method use TEST CASE: Calling hotel_price method to set a negative hotel price. EXPECTED BEHAVIOUR: The method raise a ValueError exception because the price is negative. """ with pytest.raises(ValueError): default_travel.hotel_price = -1.0
def test_travel_set_positive_value_to_room_property(default_travel: Travel): """ Test case for Travel.hotel_price and Travel._hotel_price methods TEST CASE: Calling hotel_price method to set a hotel price and _hotel_price to get that price. EXPECTED BEHAVIOUR: The methods set and get the prices for a hotel correctly. """ default_travel.hotel_price = 5.0 assert default_travel._hotel_price != 0.0 assert default_travel._hotel_price == 5.0
def test_travel_cost_hotels(default_travel: Travel, default_hotels): """ Test case for Travel.cost method with Flights and Hotels TEST CASE: Calling cost method to check the total cost with only an instances of Flights and Hotels EXPECTED BEHAVIOUR: The method returns only the sum of flights cost and hotels cost. """ default_travel.ticket_price = MOCKED_TICKET_PRICE default_travel.hotel_price = MOCKED_HOTEL_PRICE default_travel._hotels = default_hotels assert default_travel.cost == DEFAULT_FLIGHT_TOTAL_COST + DEFAULT_HOTEL_TOTAL_COST