# -*- coding: utf-8 -*- # type: ignore from __future__ import annotations 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.index'), follow=False, ) # Then asserts.assertRedirects( result, reverse('ui.accounts.settings'), fetch_redirect_response=False, ) @pytest.mark.django_db def test_inactive_account(inactive_account_client: Client): # When result = inactive_account_client.get( reverse('ui.accounts.index'), ) # Then asserts.assertRedirects( result, reverse( 'ui.accounts.login', query=[('next', reverse('ui.accounts.index'))], ), fetch_redirect_response=False, ) @pytest.mark.django_db def test_anonymous(client: Client): # When result = client.get( reverse('ui.accounts.index'), ) # Then asserts.assertRedirects( result, reverse( 'ui.accounts.login', query=[('next', reverse('ui.accounts.index'))], ), fetch_redirect_response=False, )