def test_unlock_quotation_not_locked(service: UpdateReservationInOdoo, context: Context, house, user, reservation): context.house = house context.user = user context.reservation = reservation context.is_need_update_quotation = True context.is_locked_quotation = False context.api = Mock(unlock_quotation=Mock(side_effect=RuntimeError('ERR'))) result = service.unlock_quotation(context) assert is_successful(result) context.api.unlock_quotation.assert_not_called()
def test_missed_house_id(service: UpdateReservationInOdoo, context: Context): context.house_id = None result = service.select_house(context) assert not is_successful(result) assert result.failure().failure == ReservationErrors.missed_house
def context(house, reservation, user) -> Context: return Context(house_id=house.id, pk=reservation.id, user_id=user.id)