Update pytest style to match update Ruff rules

This commit is contained in:
Bruno Alla 2024-08-15 16:33:51 +02:00
parent 5e1377d860
commit a5e6a1521f
No known key found for this signature in database
5 changed files with 7 additions and 7 deletions

View File

@ -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()

View File

@ -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")

View File

@ -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()

View File

@ -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()

View File

@ -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)