Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 26, 2024
1 parent 048b9e4 commit fa0ac74
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions fixtures/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def warnings_as_errors(): # noqa: PT004
warnings.resetwarnings()


@pytest.fixture()
@pytest.fixture
def randomness(): # noqa: PT004
"""Ensure a fixed seed for factoryboy"""
factory.fuzzy.reseed_random("happy little clouds")


@pytest.fixture()
@pytest.fixture
def mocked_celery(mocker):
"""Mock object that patches certain celery functions"""
exception_class = TabError
Expand All @@ -72,13 +72,13 @@ def mocked_celery(mocker):
)


@pytest.fixture()
@pytest.fixture
def mock_context(mocker, user):
"""Mock context for serializers"""
return {"request": mocker.Mock(user=user)}


@pytest.fixture()
@pytest.fixture
def mocked_responses():
"""Mock responses fixture"""
with responses.RequestsMock() as rsps:
Expand Down
18 changes: 9 additions & 9 deletions fixtures/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@
from unified_ecommerce.factories import UserFactory


@pytest.fixture()
@pytest.fixture
def user(db): # noqa: ARG001
"""Create a user"""
return UserFactory.create()


@pytest.fixture()
@pytest.fixture
def staff_user(db): # noqa: ARG001
"""Create a staff user"""
return UserFactory.create(is_staff=True)


@pytest.fixture()
@pytest.fixture
def logged_in_user(client, user):
"""Log the user in and yield the user object"""
client.force_login(user)
return user


@pytest.fixture()
@pytest.fixture
def logged_in_profile(client):
"""Add a Profile and logged-in User"""
user = UserFactory.create(username="george")
client.force_login(user)
return user.profile


@pytest.fixture()
@pytest.fixture
def jwt_token(db, user, client, rf, settings): # noqa: ARG001
"""Creates a JWT token for a regular user""" # noqa: D401
jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
Expand All @@ -50,31 +50,31 @@ def jwt_token(db, user, client, rf, settings): # noqa: ARG001
return token


@pytest.fixture()
@pytest.fixture
def client(db): # noqa: ARG001
"""
Similar to the builtin client but this provides the DRF client instead of the Django test client.
""" # noqa: E501
return APIClient()


@pytest.fixture()
@pytest.fixture
def user_client(user):
"""Version of the client that is authenticated with the user"""
client = APIClient()
client.force_authenticate(user=user)
return client


@pytest.fixture()
@pytest.fixture
def staff_client(staff_user):
"""Version of the client that is authenticated with the staff_user"""
client = APIClient()
client.force_authenticate(user=staff_user)
return client


@pytest.fixture()
@pytest.fixture
def profile_image():
"""Create a PNG image"""
image_file = BytesIO()
Expand Down
2 changes: 1 addition & 1 deletion repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

sys.exit(
check_call(
[ # noqa: S603
[
os.path.join(base_dir, "manage.py"), # noqa: PTH118
"shell",
*sys.argv[1:],
Expand Down
4 changes: 2 additions & 2 deletions system_meta/views_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_update( # noqa: PLR0913
),
],
)
def test_delete( # noqa: PLR0913
def test_delete(
self, is_logged_in, use_staff_user, client, user_client, staff_client
):
"""Test that the viewset can delete an object."""
Expand Down Expand Up @@ -309,7 +309,7 @@ def test_update( # noqa: PLR0913
),
],
)
def test_delete( # noqa: PLR0913
def test_delete(
self, is_logged_in, use_staff_user, client, user_client, staff_client
):
"""Test that the viewset can delete an object."""
Expand Down
2 changes: 1 addition & 1 deletion unified_ecommerce/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "unified_ecommerce.settings")

from django.conf import settings # noqa: E402
from django.conf import settings

app = Celery("unified_ecommerce")
app.config_from_object("django.conf:settings", namespace="CELERY")
Expand Down
2 changes: 1 addition & 1 deletion unified_ecommerce/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def _test_retrieval(self, api_client, url, url_name, **kwargs): # noqa: ARG002
assert response.status_code < 500
return response

def _determine_client_wrapper( # noqa: PLR0913
def _determine_client_wrapper(
self, is_logged_in, use_staff_user, client, user_client, staff_client
):
"""
Expand Down
2 changes: 1 addition & 1 deletion unified_ecommerce/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_markdown_to_plain_text():
assert html_to_plain_text(normal_text) == normal_text


@pytest.mark.django_db()
@pytest.mark.django_db
@pytest.mark.parametrize("chunk_size", [2, 3, 5, 7, 9, 10])
def test_prefetched_iterator(chunk_size):
"""
Expand Down

0 comments on commit fa0ac74

Please sign in to comment.