hotpocket/services/backend/tests/ui/views/accounts/test_browse.py
Tomek Wójcik b4338e2769
Some checks failed
CI / Checks (push) Failing after 13m2s
Release v1.0.0
2025-08-20 21:00:50 +02:00

58 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
# type: ignore
from __future__ import annotations
import http
from django.test import Client
from django.urls import reverse
import pytest
from pytest_django import asserts
@pytest.mark.django_db
def test_ok(authenticated_client: Client):
# When
result = authenticated_client.get(
reverse('ui.accounts.browse'),
)
# Then
assert result.status_code == http.HTTPStatus.NOT_FOUND
@pytest.mark.django_db
def test_inactive_account(inactive_account_client: Client):
# When
result = inactive_account_client.get(
reverse('ui.accounts.browse'),
)
# Then
asserts.assertRedirects(
result,
reverse(
'ui.accounts.login',
query=[('next', reverse('ui.accounts.browse'))],
),
fetch_redirect_response=False,
)
@pytest.mark.django_db
def test_anonymous(client: Client):
# When
result = client.get(
reverse('ui.accounts.browse'),
)
# Then
asserts.assertRedirects(
result,
reverse(
'ui.accounts.login',
query=[('next', reverse('ui.accounts.browse'))],
),
fetch_redirect_response=False,
)