mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-07 13:34:53 +03:00
Update pytest style to match update Ruff rules
This commit is contained in:
parent
5e1377d860
commit
a5e6a1521f
|
@ -9,6 +9,6 @@ def _media_storage(settings, tmpdir) -> None:
|
|||
settings.MEDIA_ROOT = tmpdir.strpath
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest.fixture
|
||||
def user(db) -> User:
|
||||
return UserFactory()
|
||||
|
|
|
@ -56,7 +56,7 @@ class TestUserAdmin:
|
|||
response = admin_client.get(url)
|
||||
assert response.status_code == HTTPStatus.OK
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest.fixture
|
||||
def _force_allauth(self, settings):
|
||||
settings.DJANGO_ADMIN_FORCE_ALLAUTH = True
|
||||
# Reload the admin module to apply the setting change
|
||||
|
@ -65,7 +65,7 @@ class TestUserAdmin:
|
|||
with contextlib.suppress(admin.sites.AlreadyRegistered): # type: ignore[attr-defined]
|
||||
reload(users_admin)
|
||||
|
||||
@pytest.mark.django_db()
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.usefixtures("_force_allauth")
|
||||
def test_allauth_login(self, rf, settings):
|
||||
request = rf.get("/fake-url")
|
||||
|
|
|
@ -6,7 +6,7 @@ from {{ cookiecutter.project_slug }}.users.models import User
|
|||
|
||||
|
||||
class TestUserViewSet:
|
||||
@pytest.fixture()
|
||||
@pytest.fixture
|
||||
def api_rf(self) -> APIRequestFactory:
|
||||
return APIRequestFactory()
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.core.management import call_command
|
|||
from {{ cookiecutter.project_slug }}.users.models import User
|
||||
|
||||
|
||||
@pytest.mark.django_db()
|
||||
@pytest.mark.django_db
|
||||
class TestUserManager:
|
||||
def test_create_user(self):
|
||||
user = User.objects.create_user(
|
||||
|
@ -37,7 +37,7 @@ class TestUserManager:
|
|||
assert user.username is None
|
||||
|
||||
|
||||
@pytest.mark.django_db()
|
||||
@pytest.mark.django_db
|
||||
def test_createsuperuser_command():
|
||||
"""Ensure createsuperuser command works with our custom manager."""
|
||||
out = StringIO()
|
||||
|
|
|
@ -10,7 +10,7 @@ def test_swagger_accessible_by_admin(admin_client):
|
|||
assert response.status_code == HTTPStatus.OK
|
||||
|
||||
|
||||
@pytest.mark.django_db()
|
||||
@pytest.mark.django_db
|
||||
def test_swagger_ui_not_accessible_by_normal_user(client):
|
||||
url = reverse("api-docs")
|
||||
response = client.get(url)
|
||||
|
|
Loading…
Reference in New Issue
Block a user