Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/api/views/test_origin_save.py
Show All 14 Lines | from swh.web.common.models import ( | ||||
SAVE_REQUEST_REJECTED, | SAVE_REQUEST_REJECTED, | ||||
SAVE_TASK_FAILED, | SAVE_TASK_FAILED, | ||||
SAVE_TASK_NOT_CREATED, | SAVE_TASK_NOT_CREATED, | ||||
SAVE_TASK_NOT_YET_SCHEDULED, | SAVE_TASK_NOT_YET_SCHEDULED, | ||||
SAVE_TASK_SCHEDULED, | SAVE_TASK_SCHEDULED, | ||||
SAVE_TASK_SUCCEEDED, | SAVE_TASK_SUCCEEDED, | ||||
VISIT_STATUS_FAILED, | VISIT_STATUS_FAILED, | ||||
VISIT_STATUS_FULL, | VISIT_STATUS_FULL, | ||||
SaveAuthorizedOrigin, | |||||
SaveOriginRequest, | SaveOriginRequest, | ||||
SaveUnauthorizedOrigin, | SaveUnauthorizedOrigin, | ||||
) | ) | ||||
from swh.web.common.utils import reverse | from swh.web.common.utils import reverse | ||||
from swh.web.tests.utils import check_api_get_responses, check_api_post_responses | from swh.web.tests.utils import check_api_get_responses, check_api_post_responses | ||||
pytestmark = pytest.mark.django_db | pytestmark = pytest.mark.django_db | ||||
@pytest.fixture(autouse=True) | @pytest.fixture(autouse=True) | ||||
def populated_db(): | def populated_db(): | ||||
SaveAuthorizedOrigin.objects.create(url="https://github.com/"), | |||||
SaveAuthorizedOrigin.objects.create(url="https://gitlab.com/"), | |||||
SaveUnauthorizedOrigin.objects.create(url="https://github.com/user/illegal_repo") | SaveUnauthorizedOrigin.objects.create(url="https://github.com/user/illegal_repo") | ||||
SaveUnauthorizedOrigin.objects.create(url="https://gitlab.com/user_to_exclude") | SaveUnauthorizedOrigin.objects.create(url="https://gitlab.com/user_to_exclude") | ||||
def test_invalid_visit_type(api_client): | def test_invalid_visit_type(api_client): | ||||
url = reverse( | url = reverse( | ||||
"api-1-save-origin", | "api-1-save-origin", | ||||
url_args={ | url_args={ | ||||
▲ Show 20 Lines • Show All 332 Lines • Show Last 20 Lines |