Skip to content

Commit

Permalink
[Fix] Resolve lint errors (#328)
Browse files Browse the repository at this point in the history
* fix 🔧 resolve lint errors

* fix 🔧 resolve pylint errors

* fix 🔧 resolve tests failing
  • Loading branch information
samar-hassan authored Jan 24, 2024
1 parent c76343a commit 1e10a52
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ version-django-oscar-commerce-connect.txt
sandbox/media/
sandbox/static/
docs/build/
lint.installed
lint.installed
.vscode
1 change: 1 addition & 0 deletions oscarapi/fixtures/offer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<field type="PositiveIntegerField" name="num_applications">0</field>
<field type="PositiveIntegerField" name="num_orders">0</field>
<field type="CharField" name="redirect_url"/>
<field type="BooleanField" name="exclusive">False</field>
<field type="DateTimeField" name="date_created">2015-11-16T11:08:15.653721+00:00</field>
</object>
<object pk="1" model="offer.benefit">
Expand Down
1 change: 1 addition & 0 deletions oscarapi/fixtures/voucher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<field type="PositiveIntegerField" name="num_applications">0</field>
<field type="PositiveIntegerField" name="num_orders">0</field>
<field type="CharField" name="redirect_url"></field>
<field type="BooleanField" name="exclusive">False</field>
<field type="DateTimeField" name="date_created">2015-11-27T15:38:48.134807+00:00</field>
</object>
<object pk="2" model="offer.benefit">
Expand Down
2 changes: 1 addition & 1 deletion oscarapi/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.contrib.sessions.middleware import SessionMiddleware
from django.core.exceptions import PermissionDenied
from django.http.response import HttpResponse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from oscar.core.loading import get_class

Expand Down
1 change: 1 addition & 0 deletions oscarapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
`OSCARAPI_`. So :const:`oscarapi.settings.EXPOSE_USER_DETAILS` becomes:
`OSCARAPI_EXPOSE_USER_DETAILS`
"""

from django.contrib.auth import get_user_model
from oscarapi.utils.settings import overridable
from oscarapi import version
Expand Down
8 changes: 1 addition & 7 deletions oscarapi/signals.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import django
from django.dispatch import Signal


oscarapi_post_checkout_args = ["order", "user", "request", "response"]

if django.VERSION >= (3, 0):
oscarapi_post_checkout = Signal()
else:
oscarapi_post_checkout = Signal(providing_args=oscarapi_post_checkout_args)
oscarapi_post_checkout = Signal()
2 changes: 1 addition & 1 deletion oscarapi/tests/unit/testmiddleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_process_request(self):
request = self.rf.get(
basket_url, HTTP_SESSION_ID="SID:ANON:example.com:987171879"
)
response = HeaderSessionMiddleware().process_request(request)
response = HeaderSessionMiddleware(lambda: None).process_request(request)
self.assertEqual(response.status_code, 403)
self.assertEqual(
response.content,
Expand Down
9 changes: 6 additions & 3 deletions oscarapi/tests/unit/testproduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,8 +1173,9 @@ def test_add_local_image(self):
"description": "Henk",
"images": [
{
"original": "https://testserver/%s/image.jpg"
% settings.MEDIA_ROOT,
"original": (
"https://testserver/%s/image.jpg" % settings.MEDIA_ROOT
),
"caption": "HA! IK HEET HARRIE",
}
],
Expand Down Expand Up @@ -1210,7 +1211,9 @@ def test_add_broken_image(self, urlopen):
"description": "Henk",
"images": [
{
"original": "https://example.com/image-that-does-not-exist-at-all.png",
"original": (
"https://example.com/image-that-does-not-exist-at-all.png"
),
"caption": "HA! IK HEET HARRIE",
}
],
Expand Down
1 change: 1 addition & 0 deletions oscarapi/utils/exists.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module contains functions that can be used to identify an existing piece
of data in the database based on it's unique attributes
"""

from django.db import models

from oscar.core.loading import get_model
Expand Down

0 comments on commit 1e10a52

Please sign in to comment.