API

This package contains tests of the integreat_cms.api app

API Config

This modules contains the config for the API tests

tests.api.api_config.API_ENDPOINTS: Final[list[tuple[str, str, str, int, int]]] = [('/api/v3/regions/', '/wp-json/extensions/v3/sites/', 'tests/api/expected-outputs/regions.json', 200, 8), ('/api/v3/regions/augsburg/', '/wp-json/extensions/v3/sites/augsburg/', 'tests/api/expected-outputs/regions_augsburg.json', 200, 3), ('/api/v3/regions/nurnberg/', '/wp-json/extensions/v3/sites/nurnberg/', 'tests/api/expected-outputs/regions_nurnberg.json', 200, 3), ('/api/v3/augsburg/languages/', '/augsburg/de/wp-json/extensions/v3/languages/', 'tests/api/expected-outputs/augsburg_languages.json', 200, 2), ('/api/v3/nurnberg/languages/', '/nurnberg/de/wp-json/extensions/v3/languages/', 'tests/api/expected-outputs/nurnberg_languages.json', 200, 2), ('/api/v3/augsburg/de/pages/', '/augsburg/de/wp-json/extensions/v3/pages/', 'tests/api/expected-outputs/augsburg_de_pages.json', 200, 6), ('/api/v3/augsburg/ar/pages/', '/augsburg/ar/wp-json/extensions/v3/pages/', 'tests/api/expected-outputs/augsburg_ar_pages.json', 200, 6), ('/api/v3/augsburg/non-existing/pages/', '/augsburg/non-existing/wp-json/extensions/v3/pages/', 'tests/api/expected-outputs/augsburg_non-existing_pages.json', 404, 2), ('/api/v3/augsburg/de/locations/', '/augsburg/de/wp-json/extensions/v3/locations/', 'tests/api/expected-outputs/augsburg_de_locations.json', 200, 5), ('/api/v3/augsburg/en/locations/', '/augsburg/en/wp-json/extensions/v3/locations/', 'tests/api/expected-outputs/augsburg_en_locations.json', 200, 5), ('/api/v3/augsburg/ar/locations/', '/augsburg/ar/wp-json/extensions/v3/locations/', 'tests/api/expected-outputs/augsburg_ar_locations.json', 200, 5), ('/api/v3/augsburg/non-existing/locations/', '/augsburg/non-existing/wp-json/extensions/v3/locations/', 'tests/api/expected-outputs/augsburg_non-existing_locations.json', 404, 2), ('/api/v3/augsburg/de/location-categories/', '/augsburg/de/wp-json/extensions/v3/location-categories/', 'tests/api/expected-outputs/augsburg_de_location_categories.json', 200, 12), ('/api/v3/augsburg/en/location-categories/', '/augsburg/en/wp-json/extensions/v3/location-categories/', 'tests/api/expected-outputs/augsburg_en_location_categories.json', 200, 12), ('/api/v3/augsburg/ar/location-categories/', '/augsburg/ar/wp-json/extensions/v3/location-categories/', 'tests/api/expected-outputs/augsburg_ar_location_categories.json', 200, 12), ('/api/v3/augsburg/de/children/', '/augsburg/de/wp-json/extensions/v3/children/', 'tests/api/expected-outputs/augsburg_de_children.json', 200, 14), ('/api/v3/augsburg/de/children/?depth=3&url=/augsburg/de/behörden-und-beratung/behörden/', '/augsburg/de/wp-json/extensions/v3/children/?depth=3&url=/augsburg/de/behörden-und-beratung/behörden/', 'tests/api/expected-outputs/augsburg_de_children_archived_descendants.json', 200, 14), ('/augsburg/de/wp-json/extensions/v3/page/?url=/augsburg/de/behörden-und-beratung/behörden/archiviertes-amt/', '/augsburg/de/wp-json/extensions/v3/page/?url=/augsburg/de/behörden-und-beratung/behörden/archiviertes-amt/', 'tests/api/expected-outputs/augsburg_de_page_archived.json', 404, 4), ('/api/v3/augsburg/de/children/?depth=2', '/augsburg/de/wp-json/extensions/v3/children/?depth=2', 'tests/api/expected-outputs/augsburg_de_children_depth_2.json', 200, 14), ('/api/v3/augsburg/de/events/', '/augsburg/de/wp-json/extensions/v3/events/', 'tests/api/expected-outputs/augsburg_de_events.json', 200, 5), ('/api/v3/augsburg/de/events/?combine_recurring=True', '/augsburg/de/wp-json/extensions/v3/events/?combine_recurring=True', 'tests/api/expected-outputs/augsburg_de_events_combine_recurring.json', 200, 5), ('/api/v3/augsburg/en/events/', '/augsburg/en/wp-json/extensions/v3/events/', 'tests/api/expected-outputs/augsburg_en_events.json', 200, 5), ('/api/v3/augsburg/ar/events/', '/augsburg/ar/wp-json/extensions/v3/events/', 'tests/api/expected-outputs/augsburg_ar_events.json', 200, 5), ('/api/v3/augsburg/non-existing/events/', '/augsburg/non-existing/wp-json/extensions/v3/events/', 'tests/api/expected-outputs/augsburg_non-existing_events.json', 404, 2), ('/api/v3/augsburg/de/page/?id=1', '/augsburg/de/wp-json/extensions/v3/page/?id=1', 'tests/api/expected-outputs/augsburg_de_page_1.json', 200, 5), ('/api/v3/augsburg/de/imprint/', '/augsburg/de/wp-json/extensions/v3/disclaimer/', 'tests/api/expected-outputs/augsburg_de_imprint.json', 200, 4), ('/api/v3/augsburg/en/imprint/', '/augsburg/en/wp-json/extensions/v3/disclaimer/', 'tests/api/expected-outputs/augsburg_en_imprint.json', 200, 4), ('/api/v3/augsburg/non-existing/imprint/', '/augsburg/non-existing/wp-json/extensions/v3/disclaimer/', 'tests/api/expected-outputs/augsburg_non-existing_imprint.json', 404, 2), ('/api/v3/nurnberg/de/events/', '/nurnberg/de/wp-json/extensions/v3/events/', 'tests/api/expected-outputs/nurnberg_de_events.json', 200, 9), ('/api/v3/nurnberg/en/events/', '/nurnberg/en/wp-json/extensions/v3/events/', 'tests/api/expected-outputs/nurnberg_en_events.json', 200, 9), ('/api/v3/nurnberg/ar/events/', '/nurnberg/ar/wp-json/extensions/v3/events/', 'tests/api/expected-outputs/nurnberg_ar_events.json', 200, 5), ('/api/v3/nurnberg/de/locations/', '/nurnberg/de/wp-json/extensions/v3/locations/', 'tests/api/expected-outputs/nurnberg_de_locations.json', 200, 5), ('/api/v3/nurnberg/en/locations/', '/nurnberg/en/wp-json/extensions/v3/locations/', 'tests/api/expected-outputs/nurnberg_en_locations.json', 200, 5), ('/api/v3/nurnberg/ar/locations/', '/nurnberg/ar/wp-json/extensions/v3/locations/', 'tests/api/expected-outputs/nurnberg_ar_locations.json', 200, 5), ('/api/v3/nurnberg/de/imprint/', '/nurnberg/de/wp-json/extensions/v3/disclaimer/', 'tests/api/expected-outputs/nurnberg_de_imprint.json', 200, 3), ('/api/v3/nurnberg/en/imprint/', '/nurnberg/en/wp-json/extensions/v3/disclaimer/', 'tests/api/expected-outputs/nurnberg_en_imprint.json', 200, 3), ('/api/v3/nurnberg/de/fcm/', '/nurnberg/de/wp-json/extensions/v3/fcm/', 'tests/api/expected-outputs/nurnberg_de_fcm.json', 200, 3), ('/api/v3/nurnberg/en/fcm/', '/nurnberg/en/wp-json/extensions/v3/fcm/', 'tests/api/expected-outputs/nurnberg_en_fcm.json', 200, 3), ('/api/v3/nurnberg/ar/fcm/', '/nurnberg/ar/wp-json/extensions/v3/fcm/', 'tests/api/expected-outputs/nurnberg_ar_fcm.json', 200, 3), ('/api/v3/augsburg/de/extras/', '/augsburg/de/wp-json/extensions/v3/extras/', 'tests/api/expected-outputs/augsburg-offers.json', 200, 3)][source]

The API endpoints

[
    (
        '/api/v3/regions/',
        '/wp-json/extensions/v3/sites/',
        'tests/api/expected-outputs/regions.json',
        200,
        8,
    ),
    (
        '/api/v3/regions/augsburg/',
        '/wp-json/extensions/v3/sites/augsburg/',
        'tests/api/expected-outputs/regions_augsburg.json',
        200,
        3,
    ),
    (
        '/api/v3/regions/nurnberg/',
        '/wp-json/extensions/v3/sites/nurnberg/',
        'tests/api/expected-outputs/regions_nurnberg.json',
        200,
        3,
    ),
    (
        '/api/v3/augsburg/languages/',
        '/augsburg/de/wp-json/extensions/v3/languages/',
        'tests/api/expected-outputs/augsburg_languages.json',
        200,
        2,
    ),
    (
        '/api/v3/nurnberg/languages/',
        '/nurnberg/de/wp-json/extensions/v3/languages/',
        'tests/api/expected-outputs/nurnberg_languages.json',
        200,
        2,
    ),
    (
        '/api/v3/augsburg/de/pages/',
        '/augsburg/de/wp-json/extensions/v3/pages/',
        'tests/api/expected-outputs/augsburg_de_pages.json',
        200,
        6,
    ),
    (
        '/api/v3/augsburg/ar/pages/',
        '/augsburg/ar/wp-json/extensions/v3/pages/',
        'tests/api/expected-outputs/augsburg_ar_pages.json',
        200,
        6,
    ),
    (
        '/api/v3/augsburg/non-existing/pages/',
        '/augsburg/non-existing/wp-json/extensions/v3/pages/',
        'tests/api/expected-outputs/augsburg_non-existing_pages.json',
        404,
        2,
    ),
    (
        '/api/v3/augsburg/de/locations/',
        '/augsburg/de/wp-json/extensions/v3/locations/',
        'tests/api/expected-outputs/augsburg_de_locations.json',
        200,
        5,
    ),
    (
        '/api/v3/augsburg/en/locations/',
        '/augsburg/en/wp-json/extensions/v3/locations/',
        'tests/api/expected-outputs/augsburg_en_locations.json',
        200,
        5,
    ),
    (
        '/api/v3/augsburg/ar/locations/',
        '/augsburg/ar/wp-json/extensions/v3/locations/',
        'tests/api/expected-outputs/augsburg_ar_locations.json',
        200,
        5,
    ),
    (
        '/api/v3/augsburg/non-existing/locations/',
        '/augsburg/non-existing/wp-json/extensions/v3/locations/',
        'tests/api/expected-outputs/augsburg_non-existing_locations.json',
        404,
        2,
    ),
    (
        '/api/v3/augsburg/de/location-categories/',
        '/augsburg/de/wp-json/extensions/v3/location-categories/',
        'tests/api/expected-outputs/augsburg_de_location_categories.json',
        200,
        12,
    ),
    (
        '/api/v3/augsburg/en/location-categories/',
        '/augsburg/en/wp-json/extensions/v3/location-categories/',
        'tests/api/expected-outputs/augsburg_en_location_categories.json',
        200,
        12,
    ),
    (
        '/api/v3/augsburg/ar/location-categories/',
        '/augsburg/ar/wp-json/extensions/v3/location-categories/',
        'tests/api/expected-outputs/augsburg_ar_location_categories.json',
        200,
        12,
    ),
    (
        '/api/v3/augsburg/de/children/',
        '/augsburg/de/wp-json/extensions/v3/children/',
        'tests/api/expected-outputs/augsburg_de_children.json',
        200,
        14,
    ),
    (
        '/api/v3/augsburg/de/children/?depth=3&url=/augsburg/de/behörden-und-beratung/behörden/',
        '/augsburg/de/wp-json/extensions/v3/children/?depth=3&url=/augsburg/de/behörden-und-beratung/behörden/',
        'tests/api/expected-outputs/augsburg_de_children_archived_descendants.json',
        200,
        14,
    ),
    (
        '/augsburg/de/wp-json/extensions/v3/page/?url=/augsburg/de/behörden-und-beratung/behörden/archiviertes-amt/',
        '/augsburg/de/wp-json/extensions/v3/page/?url=/augsburg/de/behörden-und-beratung/behörden/archiviertes-amt/',
        'tests/api/expected-outputs/augsburg_de_page_archived.json',
        404,
        4,
    ),
    (
        '/api/v3/augsburg/de/children/?depth=2',
        '/augsburg/de/wp-json/extensions/v3/children/?depth=2',
        'tests/api/expected-outputs/augsburg_de_children_depth_2.json',
        200,
        14,
    ),
    (
        '/api/v3/augsburg/de/events/',
        '/augsburg/de/wp-json/extensions/v3/events/',
        'tests/api/expected-outputs/augsburg_de_events.json',
        200,
        5,
    ),
    (
        '/api/v3/augsburg/de/events/?combine_recurring=True',
        '/augsburg/de/wp-json/extensions/v3/events/?combine_recurring=True',
        'tests/api/expected-outputs/augsburg_de_events_combine_recurring.json',
        200,
        5,
    ),
    (
        '/api/v3/augsburg/en/events/',
        '/augsburg/en/wp-json/extensions/v3/events/',
        'tests/api/expected-outputs/augsburg_en_events.json',
        200,
        5,
    ),
    (
        '/api/v3/augsburg/ar/events/',
        '/augsburg/ar/wp-json/extensions/v3/events/',
        'tests/api/expected-outputs/augsburg_ar_events.json',
        200,
        5,
    ),
    (
        '/api/v3/augsburg/non-existing/events/',
        '/augsburg/non-existing/wp-json/extensions/v3/events/',
        'tests/api/expected-outputs/augsburg_non-existing_events.json',
        404,
        2,
    ),
    (
        '/api/v3/augsburg/de/page/?id=1',
        '/augsburg/de/wp-json/extensions/v3/page/?id=1',
        'tests/api/expected-outputs/augsburg_de_page_1.json',
        200,
        5,
    ),
    (
        '/api/v3/augsburg/de/imprint/',
        '/augsburg/de/wp-json/extensions/v3/disclaimer/',
        'tests/api/expected-outputs/augsburg_de_imprint.json',
        200,
        4,
    ),
    (
        '/api/v3/augsburg/en/imprint/',
        '/augsburg/en/wp-json/extensions/v3/disclaimer/',
        'tests/api/expected-outputs/augsburg_en_imprint.json',
        200,
        4,
    ),
    (
        '/api/v3/augsburg/non-existing/imprint/',
        '/augsburg/non-existing/wp-json/extensions/v3/disclaimer/',
        'tests/api/expected-outputs/augsburg_non-existing_imprint.json',
        404,
        2,
    ),
    (
        '/api/v3/nurnberg/de/events/',
        '/nurnberg/de/wp-json/extensions/v3/events/',
        'tests/api/expected-outputs/nurnberg_de_events.json',
        200,
        9,
    ),
    (
        '/api/v3/nurnberg/en/events/',
        '/nurnberg/en/wp-json/extensions/v3/events/',
        'tests/api/expected-outputs/nurnberg_en_events.json',
        200,
        9,
    ),
    (
        '/api/v3/nurnberg/ar/events/',
        '/nurnberg/ar/wp-json/extensions/v3/events/',
        'tests/api/expected-outputs/nurnberg_ar_events.json',
        200,
        5,
    ),
    (
        '/api/v3/nurnberg/de/locations/',
        '/nurnberg/de/wp-json/extensions/v3/locations/',
        'tests/api/expected-outputs/nurnberg_de_locations.json',
        200,
        5,
    ),
    (
        '/api/v3/nurnberg/en/locations/',
        '/nurnberg/en/wp-json/extensions/v3/locations/',
        'tests/api/expected-outputs/nurnberg_en_locations.json',
        200,
        5,
    ),
    (
        '/api/v3/nurnberg/ar/locations/',
        '/nurnberg/ar/wp-json/extensions/v3/locations/',
        'tests/api/expected-outputs/nurnberg_ar_locations.json',
        200,
        5,
    ),
    (
        '/api/v3/nurnberg/de/imprint/',
        '/nurnberg/de/wp-json/extensions/v3/disclaimer/',
        'tests/api/expected-outputs/nurnberg_de_imprint.json',
        200,
        3,
    ),
    (
        '/api/v3/nurnberg/en/imprint/',
        '/nurnberg/en/wp-json/extensions/v3/disclaimer/',
        'tests/api/expected-outputs/nurnberg_en_imprint.json',
        200,
        3,
    ),
    (
        '/api/v3/nurnberg/de/fcm/',
        '/nurnberg/de/wp-json/extensions/v3/fcm/',
        'tests/api/expected-outputs/nurnberg_de_fcm.json',
        200,
        3,
    ),
    (
        '/api/v3/nurnberg/en/fcm/',
        '/nurnberg/en/wp-json/extensions/v3/fcm/',
        'tests/api/expected-outputs/nurnberg_en_fcm.json',
        200,
        3,
    ),
    (
        '/api/v3/nurnberg/ar/fcm/',
        '/nurnberg/ar/wp-json/extensions/v3/fcm/',
        'tests/api/expected-outputs/nurnberg_ar_fcm.json',
        200,
        3,
    ),
    (
        '/api/v3/augsburg/de/extras/',
        '/augsburg/de/wp-json/extensions/v3/extras/',
        'tests/api/expected-outputs/augsburg-offers.json',
        200,
        3,
    ),
]
tests.api.api_config.API_FEEDBACK_VIEWS: Final[list[tuple[str, dict[str, str]]]] = [('api:legacy_feedback_endpoint', {'category': 'Inhalte', 'comment': 'Cool page!', 'permalink': '/augsburg/de/willkommen', 'rating': 'up'}), ('api:legacy_feedback_endpoint', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'permalink': '/augsburg/de/willkommen', 'rating': 'down'}), ('api:legacy_feedback_endpoint', {'category': 'Inhalte', 'comment': 'Cool event!', 'permalink': '/augsburg/de/events/test-veranstaltung', 'rating': 'up'}), ('api:legacy_feedback_endpoint', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'permalink': '/augsburg/de/events/test-veranstaltung', 'rating': 'down'}), ('api:region_feedback', {'category': 'Inhalte', 'rating': 'up'}), ('api:region_feedback', {'category': 'Inhalte', 'comment': 'Feedback ohne Bewertung'}), ('api:region_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down'}), ('api:page_feedback', {'category': 'Inhalte', 'comment': 'Cool page!', 'rating': 'up', 'slug': 'willkommen'}), ('api:page_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down', 'slug': 'willkommen'}), ('api:poi_feedback', {'category': 'Inhalte', 'comment': 'Cool POI!', 'rating': 'up', 'slug': 'test-ort'}), ('api:poi_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down', 'slug': 'test-ort'}), ('api:event_feedback', {'category': 'Inhalte', 'comment': 'Cool event!', 'rating': 'up', 'slug': 'test-veranstaltung'}), ('api:event_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down', 'slug': 'test-veranstaltung$2030-01-01'}), ('api:event_list_feedback', {'category': 'Inhalte', 'comment': 'Cool events!', 'rating': 'up'}), ('api:event_list_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down'}), ('api:imprint_page_feedbacks', {'category': 'Inhalte', 'comment': 'Cool imprint!', 'rating': 'up'}), ('api:imprint_page_feedbacks', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down'}), ('api:map_feedback', {'category': 'Inhalte', 'comment': 'Cool map!', 'rating': 'up'}), ('api:map_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down'}), ('api:search_result_feedback', {'category': 'Inhalte', 'comment': 'Cool search results!', 'query': 'search query', 'rating': 'up'}), ('api:search_result_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'query': 'search query', 'rating': 'down'}), ('api:offer_list_feedback', {'category': 'Inhalte', 'comment': 'Cool offers!', 'rating': 'up'}), ('api:offer_list_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down'}), ('api:offer_feedback', {'category': 'Inhalte', 'comment': 'Cool offer!', 'rating': 'up', 'slug': 'sprungbrett'}), ('api:offer_feedback', {'category': 'Technisches Feedback', 'comment': 'Strange bug!', 'rating': 'down', 'slug': 'sprungbrett'})][source]

This list contains the config for all API feedback views

[
    (
        'api:legacy_feedback_endpoint',
        {
            'category': 'Inhalte',
            'comment': 'Cool page!',
            'permalink': '/augsburg/de/willkommen',
            'rating': 'up',
        },
    ),
    (
        'api:legacy_feedback_endpoint',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'permalink': '/augsburg/de/willkommen',
            'rating': 'down',
        },
    ),
    (
        'api:legacy_feedback_endpoint',
        {
            'category': 'Inhalte',
            'comment': 'Cool event!',
            'permalink': '/augsburg/de/events/test-veranstaltung',
            'rating': 'up',
        },
    ),
    (
        'api:legacy_feedback_endpoint',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'permalink': '/augsburg/de/events/test-veranstaltung',
            'rating': 'down',
        },
    ),
    ('api:region_feedback', {'category': 'Inhalte', 'rating': 'up'}),
    (
        'api:region_feedback',
        {'category': 'Inhalte', 'comment': 'Feedback ohne Bewertung'},
    ),
    (
        'api:region_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
        },
    ),
    (
        'api:page_feedback',
        {
            'category': 'Inhalte',
            'comment': 'Cool page!',
            'rating': 'up',
            'slug': 'willkommen',
        },
    ),
    (
        'api:page_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
            'slug': 'willkommen',
        },
    ),
    (
        'api:poi_feedback',
        {
            'category': 'Inhalte',
            'comment': 'Cool POI!',
            'rating': 'up',
            'slug': 'test-ort',
        },
    ),
    (
        'api:poi_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
            'slug': 'test-ort',
        },
    ),
    (
        'api:event_feedback',
        {
            'category': 'Inhalte',
            'comment': 'Cool event!',
            'rating': 'up',
            'slug': 'test-veranstaltung',
        },
    ),
    (
        'api:event_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
            'slug': 'test-veranstaltung$2030-01-01',
        },
    ),
    (
        'api:event_list_feedback',
        {'category': 'Inhalte', 'comment': 'Cool events!', 'rating': 'up'},
    ),
    (
        'api:event_list_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
        },
    ),
    (
        'api:imprint_page_feedbacks',
        {'category': 'Inhalte', 'comment': 'Cool imprint!', 'rating': 'up'},
    ),
    (
        'api:imprint_page_feedbacks',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
        },
    ),
    (
        'api:map_feedback',
        {'category': 'Inhalte', 'comment': 'Cool map!', 'rating': 'up'},
    ),
    (
        'api:map_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
        },
    ),
    (
        'api:search_result_feedback',
        {
            'category': 'Inhalte',
            'comment': 'Cool search results!',
            'query': 'search query',
            'rating': 'up',
        },
    ),
    (
        'api:search_result_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'query': 'search query',
            'rating': 'down',
        },
    ),
    (
        'api:offer_list_feedback',
        {'category': 'Inhalte', 'comment': 'Cool offers!', 'rating': 'up'},
    ),
    (
        'api:offer_list_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
        },
    ),
    (
        'api:offer_feedback',
        {
            'category': 'Inhalte',
            'comment': 'Cool offer!',
            'rating': 'up',
            'slug': 'sprungbrett',
        },
    ),
    (
        'api:offer_feedback',
        {
            'category': 'Technisches Feedback',
            'comment': 'Strange bug!',
            'rating': 'down',
            'slug': 'sprungbrett',
        },
    ),
]

Test API Chat

tests.api.test_api_chat.test_api_chat_create_attachment_success(load_test_data: None) None[source]

Check that getting a chat containing an attachement creates the mapping in the database

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_first_chat(load_test_data: None) None[source]

Check that sending a message from a never seen-before device_id creates a new chat

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_force_new_chat(load_test_data: None) None[source]

Check that sending a message with force_new creates a new chat

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_get_attachment_incorrect_chat_failure(load_test_data: None) None[source]

Check that getting an attachment for a non-existing chat returns an error

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_get_attachment_missing_attachment_failure(load_test_data: None) None[source]

Check that getting an attachment for a non-existing attachment_id returns an error

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_get_attachment_success(load_test_data: None) None[source]

Check that getting an attachment works for an existing chat

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_get_messages_failure(load_test_data: None) None[source]

Check that GET-ing messages for a non-existing chat returns an error

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_get_messages_success(load_test_data: None) None[source]

Check that GET-ing messages works for an existing chat

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_incorrect_auth_error(load_test_data: None) None[source]

Check that incorrect auth information leads to an error

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_missing_auth_error(load_test_data: None) None[source]

Check that missing auth information leads to an error

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_ratelimiting(load_test_data: None) None[source]

Check that the ratelimiting correctly prevents further API requests

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_chat_send_message(load_test_data: None) None[source]

Check that sending a message with a known device_id works and does not create a new chat

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_chat.test_api_is_chat_enabled_for_user(load_test_data: None) None[source]

Check that whether a user is chat beta tester is stored in the DB

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

Test API Feedback

tests.api.test_api_feedback.test_api_feedback_errors(load_test_data: None, view_name: str, kwargs: dict[str, str], post_data: dict[str, str], response_data: dict[str, Any]) None[source]

Check different errors during feedback processing

Parameters:
  • load_test_data (None) – The fixture providing the test data (see load_test_data())

  • view_name (str) – The identifier of the view

  • kwargs (dict[str, str]) – The keyword argument passed to the view

  • post_data (dict[str, str]) – The post data for this view

  • response_data (dict[str, Any]) – The expected response data

Return type:

None

tests.api.test_api_feedback.test_api_feedback_invalid_method(load_test_data: None) None[source]

Check error when request method is not POST

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

tests.api.test_api_feedback.test_api_feedback_success(load_test_data: None, view_name: str, post_data: dict[str, str]) None[source]

Check successful feedback submission for different feedback types

Parameters:
  • load_test_data (None) – The fixture providing the test data (see load_test_data())

  • view_name (str) – The identifier of the view

  • post_data (dict[str, str]) – The post data for this view

Return type:

None

Test API Push Page

tests.api.test_api_push_page.test_api_push_page_content(load_test_data: None) None[source]

This test class checks all endpoints defined in API_ENDPOINTS. It verifies that the content delivered by the endpoint is equivalent with the data provided in the corresponding json file.

Parameters:

load_test_data (None) – The fixture providing the test data (see load_test_data())

Return type:

None

Test API Result

tests.api.test_api_result.test_api_result(load_test_data: None, django_assert_num_queries: Callable, endpoint: str, wp_endpoint: str, expected_result: str, expected_code: int, expected_queries: int) None[source]

This test class checks all endpoints defined in API_ENDPOINTS. It verifies that the content delivered by the endpoint is equivalent with the data provided in the corresponding json file.

Parameters:
  • load_test_data (None) – The fixture providing the test data (see load_test_data())

  • django_assert_num_queries (Callable) – The fixture providing the query assertion

  • endpoint (str) – The url of the new Django pattern

  • wp_endpoint (str) – The legacy url of the wordpress endpoint pattern

  • expected_result (str) – The path to the json file that contains the expected result

  • expected_code (int) – The expected HTTP status code

  • expected_queries (int) – The expected number of SQL queries

Return type:

None

Test API Social

tests.api.test_api_social.test_api_result(load_test_data: None, django_assert_num_queries: Callable, endpoint: str, expected_result: str, expected_code: int, expected_queries: int) None[source]

This test class checks all endpoints defined in API_ENDPOINTS. It verifies that the content delivered by the endpoint is equivalent with the data provided in the corresponding json file.

Parameters:
  • load_test_data (None) – The fixture providing the test data (see load_test_data())

  • django_assert_num_queries (Callable) – The fixture providing the query assertion

  • endpoint (str) – The url of the new Django pattern

  • expected_result (str) – The path to the json file that contains the expected result

  • expected_code (int) – The expected HTTP status code

  • expected_queries (int) – The expected number of SQL queries

Return type:

None