Skip to content

Commit

Permalink
[#13] apply flake8 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonny Bakker committed Sep 17, 2024
1 parent 259119b commit 85487eb
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/objecttypes/conf/dev.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys
import warnings

os.environ.setdefault("DEBUG", "yes")
Expand Down
5 changes: 4 additions & 1 deletion src/objecttypes/tests/test_objecttype_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "Tree",
"description": "A woody plant (deciduous or coniferous) with a root system and a single, sturdy, woody stem, branching above the ground.",
"description": (
"A woody plant (deciduous or coniferous) with a root system and a "
"single, sturdy, woody stem, branching above the ground."
),
"required": ["diameter"],
"properties": {"diameter": {"type": "integer", "description": "size in cm."}},
}
Expand Down
2 changes: 0 additions & 2 deletions src/objecttypes/tests/test_widgets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json

from django.test import TestCase

from bs4 import BeautifulSoup
Expand Down
2 changes: 1 addition & 1 deletion src/objecttypes/tests/v1/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_invalid_token(self):
TokenAuth.objects.create(contact_person="John Smith", email="[email protected]")
for url in self.urls:
with self.subTest(url=url):
response = self.client.get(url, HTTP_AUTHORIZATION=f"Token 12345")
response = self.client.get(url, HTTP_AUTHORIZATION="Token 12345")
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)

def test_valid_token(self):
Expand Down
4 changes: 1 addition & 3 deletions src/objecttypes/tests/v1/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def test_filter_public_data(self):
object_type_1 = ObjectTypeFactory.create(
data_classification=DataClassificationChoices.open
)
object_type_2 = ObjectTypeFactory.create(
data_classification=DataClassificationChoices.intern
)
ObjectTypeFactory.create(data_classification=DataClassificationChoices.intern)

response = self.client.get(
self.url, {"dataClassification": DataClassificationChoices.open}
Expand Down
14 changes: 12 additions & 2 deletions src/objecttypes/tests/v1/test_objecttype_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ def test_get_objecttypes(self):
"modifiedAt": "2020-01-01",
"allowGeometry": object_type.allow_geometry,
"versions": [
f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}"
"http://testserver{url}".format(
url=reverse(
"objectversion-detail",
args=[object_type.uuid, object_version.version],
)
)
],
},
)
Expand All @@ -68,7 +73,12 @@ def test_get_objecttypes_with_versions(self):
self.assertEqual(
data["versions"],
[
f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_versions[i].version])}"
"http://testserver{url}".format(
url=reverse(
"objectversion-detail",
args=[object_type.uuid, object_versions[i].version],
)
)
],
)

Expand Down
13 changes: 11 additions & 2 deletions src/objecttypes/tests/v1/test_objectversion_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ def test_get_versions(self):
response.json(),
[
{
"url": f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}",
"url": "http://testserver{url}".format(
url=reverse(
"objectversion-detail",
args=[object_type.uuid, object_version.version],
)
),
"version": object_version.version,
"objectType": f"http://testserver{reverse('objecttype-detail', args=[object_version.object_type.uuid])}",
"objectType": "http://testserver{url}".format(
url=reverse(
"objecttype-detail", args=[object_version.object_type.uuid]
)
),
"status": object_version.status,
"createdAt": "2020-01-01",
"modifiedAt": "2020-01-01",
Expand Down
2 changes: 1 addition & 1 deletion src/objecttypes/tests/v2/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_invalid_token(self):
TokenAuth.objects.create(contact_person="John Smith", email="[email protected]")
for url in self.urls:
with self.subTest(url=url):
response = self.client.get(url, HTTP_AUTHORIZATION=f"Token 12345")
response = self.client.get(url, HTTP_AUTHORIZATION="Token 12345")
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)

def test_valid_token(self):
Expand Down
2 changes: 1 addition & 1 deletion src/objecttypes/tests/v2/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_filter_public_data(self):
object_type_1 = ObjectTypeFactory.create(
data_classification=DataClassificationChoices.open
)
object_type_2 = ObjectTypeFactory.create(
ObjectTypeFactory.create(
data_classification=DataClassificationChoices.intern
)

Expand Down
14 changes: 12 additions & 2 deletions src/objecttypes/tests/v2/test_objecttype_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ def test_get_objecttypes(self):
"modifiedAt": "2020-01-01",
"allowGeometry": object_type.allow_geometry,
"versions": [
f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}"
"http://testserver{url}".format(
url=reverse(
"objectversion-detail",
args=[object_type.uuid, object_version.version],
)
),
],
},
)
Expand All @@ -68,7 +73,12 @@ def test_get_objecttypes_with_versions(self):
self.assertEqual(
data["versions"],
[
f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_versions[i].version])}"
"http://testserver{url}".format(
url=reverse(
"objectversion-detail",
args=[object_type.uuid, object_versions[i].version],
)
),
],
)

Expand Down
14 changes: 12 additions & 2 deletions src/objecttypes/tests/v2/test_objectversion_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ def test_get_versions(self):
"previous": None,
"results": [
{
"url": f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}",
"url": "http://testserver{url}".format(
url=reverse(
"objectversion-detail",
args=[object_type.uuid, object_version.version],
),
),
"version": object_version.version,
"objectType": f"http://testserver{reverse('objecttype-detail', args=[object_version.object_type.uuid])}",
"objectType": "http://testserver{url}".format(
url=reverse(
"objecttype-detail",
args=[object_version.object_type.uuid],
)
),
"status": object_version.status,
"createdAt": "2020-01-01",
"modifiedAt": "2020-01-01",
Expand Down
5 changes: 5 additions & 0 deletions src/objecttypes/utils/oas_extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .fields import HyperlinkedIdentityFieldExtension
from .query import DjangoFilterExtension

__all__ = [
"HyperlinkedIdentityFieldExtension",
"DjangoFilterExtension"
]
2 changes: 0 additions & 2 deletions src/objecttypes/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

from objecttypes.setup import setup_env
Expand Down

0 comments on commit 85487eb

Please sign in to comment.