Skip to content

Commit

Permalink
Test is_test field
Browse files Browse the repository at this point in the history
  • Loading branch information
juuso-j committed Jun 6, 2024
1 parent 601b7f3 commit b6da128
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions parkings/tests/api/public/test_event_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ def test_get_list_check_data(api_client, event_area):
assert properties_data['capacity_estimate'] == event_area.capacity_estimate


def test_get_list_test_event_area(api_client, event_area_factory):
event_area = event_area_factory.create()
stats_data = get(api_client, list_url)
assert stats_data["count"] == 1
event_area.is_test = True
event_area.save()
stats_data = get(api_client, list_url)
assert stats_data["count"] == 0


def test_event_area_with_price_and_price_unit_lenght(api_client, event_area):
event_area.price = Decimal(str('1.23'))
event_area.price_unit_length = 8
Expand Down
10 changes: 10 additions & 0 deletions parkings/tests/api/public/test_event_area_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ def test_get_list_check_data(api_client, event_parking_factory, event_area_facto
assert stats_data_3['current_parking_count'] == 0 # not valid parkings currently


def test_get_list_test_event_area(api_client, event_area_factory):
event_area = event_area_factory.create()
stats_data = get(api_client, list_url)
assert stats_data["count"] == 1
event_area.is_test = True
event_area.save()
stats_data = get(api_client, list_url)
assert stats_data["count"] == 0


def test_get_detail_check_data(api_client, event_parking_factory, event_area):
event_parking_factory.create_batch(3, event_area=event_area)
stats_data = get(api_client, get_detail_url(event_area))
Expand Down
10 changes: 10 additions & 0 deletions parkings/tests/api/public/test_event_area_total_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ def test_get_list_check_data(api_client, event_parking_factory, event_area_facto
assert results[4]['total_parking_count'] == 0


def test_get_list_test_event_area(api_client, event_area_factory):
event_area = event_area_factory.create()
stats_data = get(api_client, list_url)
assert stats_data["count"] == 1
event_area.is_test = True
event_area.save()
stats_data = get(api_client, list_url)
assert stats_data["count"] == 0


@pytest.mark.django_db
def test_get_detail_check_data(api_client, event_parking_factory, event_area_factory):
event_area = event_area_factory.create()
Expand Down

0 comments on commit b6da128

Please sign in to comment.