You've already forked hotpocket
This commit is contained in:
57
services/backend/tests/ui/views/accounts/test_browse.py
Normal file
57
services/backend/tests/ui/views/accounts/test_browse.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# -*- 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,
|
||||
)
|
||||
Reference in New Issue
Block a user