Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/save_origin_webhooks/test_app.py
- This file was added.
# Copyright (C) 2022 The Software Heritage developers | |||||
# See the AUTHORS file at the top-level directory of this distribution | |||||
# License: GNU Affero General Public License version 3, or any later version | |||||
# See top-level LICENSE file for more information | |||||
import pytest | |||||
from django.urls import get_resolver | |||||
@pytest.mark.django_db | |||||
def test_save_origin_webhooks_deactivate(client, staff_user, origin, django_settings): | |||||
"""Check forge webhook receivers feature is deactivated when the | |||||
save_origin_webhooks application is not in installed apps.""" | |||||
django_settings.SWH_DJANGO_APPS = [ | |||||
app | |||||
for app in django_settings.SWH_DJANGO_APPS | |||||
if app != "swh.web.save_origin_webhooks" | |||||
] | |||||
save_origin_webhooks_view_names = set( | |||||
f"api-1-origin-save-webhook-{forge_type}" | |||||
for forge_type in ("bitbucket", "gitea", "github", "gitlab", "sourceforge") | |||||
) | |||||
all_view_names = set(get_resolver().reverse_dict.keys()) | |||||
assert save_origin_webhooks_view_names & all_view_names == set() |