Skip to content

Test failure on the master branch #484

@akheron

Description

@akheron

The test_get_event_list_verify_bbox_filter fails on current master.

$ pytest -x events
...
api_client = <rest_framework.test.APIClient object at 0x401cd4b4a8>, event = <Event: tapahtuma (system:test_event) 2022-04-07 11:39:29.592576+00:00>
event2 = <Event: event (testotherdatasourceid:test_event_2) 2022-04-07 11:39:29.780281+00:00>

    @pytest.mark.django_db
    def test_get_event_list_verify_bbox_filter(api_client, event, event2):
        # API parameters must be provided in EPSG:4326 instead of the database SRS
        left_bottom = Point(25, 25)
        right_top = Point(75, 75)
        ct = CoordTransform(SpatialReference(settings.PROJECTION_SRID), SpatialReference(4326))
        left_bottom.transform(ct)
        right_top.transform(ct)
        bbox_string = f"{left_bottom.x},{left_bottom.y},{right_top.x},{right_top.y}"
        response = get_list(api_client, data={'bbox': bbox_string})
        # this way we will catch any errors if the default SRS changes, breaking the API
>       assert event.id in [entry['id'] for entry in response.data['data']]
E       AssertionError: assert 'system:test_event' in []
E        +  where 'system:test_event' = <Event: tapahtuma (system:test_event) 2022-04-07 11:39:29.592576+00:00>.id

events/tests/test_event_get.py:171: AssertionError

According to the comment, the idea of this test is to guard against "default SRS changes", whatever that means 🤷

Full `pytest` output
$ pytest -x events
============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.6.15, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
django: settings: linkedevents.test_settings (from ini)
rootdir: /app, inifile: pytest.ini
plugins: django-3.9.0
collected 374 items                                                                                                                                                                                              

events/tests/test_api.py ........                                                                                                                                                                          [  2%]
events/tests/test_auth.py ..                                                                                                                                                                               [  2%]
events/tests/test_docx.py .                                                                                                                                                                                [  2%]
events/tests/test_event.py ....                                                                                                                                                                            [  4%]
events/tests/test_event_auth_api.py .............................................................                                                                                                          [ 20%]
events/tests/test_event_get.py ........F

==================================================================================================== FAILURES ====================================================================================================
_____________________________________________________________________________________ test_get_event_list_verify_bbox_filter _____________________________________________________________________________________

api_client = <rest_framework.test.APIClient object at 0x401cd4b4a8>, event = <Event: tapahtuma (system:test_event) 2022-04-07 11:39:29.592576+00:00>
event2 = <Event: event (testotherdatasourceid:test_event_2) 2022-04-07 11:39:29.780281+00:00>

    @pytest.mark.django_db
    def test_get_event_list_verify_bbox_filter(api_client, event, event2):
        # API parameters must be provided in EPSG:4326 instead of the database SRS
        left_bottom = Point(25, 25)
        right_top = Point(75, 75)
        ct = CoordTransform(SpatialReference(settings.PROJECTION_SRID), SpatialReference(4326))
        left_bottom.transform(ct)
        right_top.transform(ct)
        bbox_string = f"{left_bottom.x},{left_bottom.y},{right_top.x},{right_top.y}"
        response = get_list(api_client, data={'bbox': bbox_string})
        # this way we will catch any errors if the default SRS changes, breaking the API
>       assert event.id in [entry['id'] for entry in response.data['data']]
E       AssertionError: assert 'system:test_event' in []
E        +  where 'system:test_event' = <Event: tapahtuma (system:test_event) 2022-04-07 11:39:29.592576+00:00>.id

events/tests/test_event_get.py:171: AssertionError
--------------------------------------------------------------------------------------------- Captured stderr setup ----------------------------------------------------------------------------------------------
2022-04-07 14:09:29,496 events.signals WARNING: No recipients for notification type 'user_created'
2022-04-07 14:09:29,644 events.signals WARNING: No recipients for notification type 'user_created'
----------------------------------------------------------------------------------------------- Captured log setup -----------------------------------------------------------------------------------------------
WARNING  events.signals:signals.py:31 No recipients for notification type 'user_created'
WARNING  events.signals:signals.py:31 No recipients for notification type 'user_created'
================================================================================================ warnings summary ================================================================================================
events/tests/test_api.py: 4 tests with warnings
events/tests/test_docx.py: 1 test with warning
events/tests/test_event_auth_api.py: 61 tests with warnings
events/tests/test_event_get.py: 9 tests with warnings
  /usr/local/lib/python3.6/site-packages/whitenoise/base.py:115: UserWarning: No directory at: /app/static/
    warnings.warn(u"No directory at: {}".format(root))

-- Docs: https://docs.pytest.org/en/latest/warnings.html
============================================================================================ short test summary info =============================================================================================
FAILED events/tests/test_event_get.py::test_get_event_list_verify_bbox_filter - AssertionError: assert 'system:test_event' in []
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 failed, 84 passed, 75 warnings in 181.31s (0:03:01) ==============================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions