Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
Expand All @@ -62,7 +61,7 @@

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"ENGINE": "django.db.backends.postgresql",
"NAME": "pokeapi_co_db",
"USER": "root",
"PASSWORD": "pokeapi",
Expand Down
4 changes: 2 additions & 2 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.conf.urls import include, url
from django.urls import include, path
from pokemon_v2 import urls as pokemon_v2_urls

# pylint: disable=invalid-name

urlpatterns = [
url(r"^", include(pokemon_v2_urls)),
path("", include(pokemon_v2_urls)),
]
1 change: 0 additions & 1 deletion config/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import os
from django.core.wsgi import get_wsgi_application


# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
Expand Down
1 change: 0 additions & 1 deletion data/v2/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from django.db import connection
from pokemon_v2.models import *


# why this way? how about use `__file__`
DATA_LOCATION = "data/v2/csv/"
DATA_LOCATION2 = os.path.join(os.path.dirname(__file__), "csv")
Expand Down
1 change: 0 additions & 1 deletion pokemon_v2/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .models import *


#########################
# SUMMARY SERIALIZERS #
#########################
Expand Down
22 changes: 13 additions & 9 deletions pokemon_v2/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2683,7 +2683,7 @@ def test_item_api(self):
item_attribute_map.save()

response = self.client.get(
"{}/item/{}/".format(API_V2, item.pk), HTTP_HOST="testserver"
"{}/item/{}/".format(API_V2, item.pk), headers={"host": "testserver"}
)

# base params
Expand Down Expand Up @@ -4683,7 +4683,7 @@ def test_pokemon_species_api(self):

response = self.client.get(
"{}/pokemon-species/{}/".format(API_V2, pokemon_species.pk),
HTTP_HOST="testserver",
headers={"host": "testserver"},
)

self.assertEqual(response.status_code, status.HTTP_200_OK)
Expand Down Expand Up @@ -4947,7 +4947,7 @@ def test_pokemon_api(self):
max_level=36,
)
response = self.client.get(
"{}/pokemon/{}/".format(API_V2, pokemon.pk), HTTP_HOST="testserver"
"{}/pokemon/{}/".format(API_V2, pokemon.pk), headers={"host": "testserver"}
)

self.assertEqual(response.status_code, status.HTTP_200_OK)
Expand Down Expand Up @@ -5171,7 +5171,7 @@ def test_pokemon_api(self):

response = self.client.get(
"{}/pokemon/?q={}".format(API_V2, pokemon.name[:2]),
HTTP_HOST="testserver",
headers={"host": "testserver"},
)

self.assertEqual(response.status_code, status.HTTP_200_OK)
Expand All @@ -5197,7 +5197,7 @@ def test_pokemon_form_api(self):

response = self.client.get(
"{}/pokemon-form/{}/".format(API_V2, pokemon_form.pk),
HTTP_HOST="testserver",
headers={"host": "testserver"},
)

self.assertEqual(response.status_code, status.HTTP_200_OK)
Expand Down Expand Up @@ -5767,13 +5767,15 @@ def test_case_insensitive_api(self):

# Test lowercase
lowercase_response = self.client.get(
"{}/pokemon/{}/".format(API_V2, lowercase_name), HTTP_HOST="testserver"
"{}/pokemon/{}/".format(API_V2, lowercase_name),
headers={"host": "testserver"},
)
self.assertEqual(lowercase_response.status_code, status.HTTP_200_OK)

# Test uppercase
uppercase_response = self.client.get(
"{}/pokemon/{}/".format(API_V2, uppercase_name), HTTP_HOST="testserver"
"{}/pokemon/{}/".format(API_V2, uppercase_name),
headers={"host": "testserver"},
)
self.assertEqual(uppercase_response.status_code, status.HTTP_200_OK)

Expand All @@ -5787,12 +5789,14 @@ def test_case_insensitive_api(self):
uppercase_name = language.name.upper()

lowercase_response = self.client.get(
"{}/language/{}/".format(API_V2, lowercase_name), HTTP_HOST="testserver"
"{}/language/{}/".format(API_V2, lowercase_name),
headers={"host": "testserver"},
)
self.assertEqual(lowercase_response.status_code, status.HTTP_200_OK)

uppercase_response = self.client.get(
"{}/language/{}/".format(API_V2, uppercase_name), HTTP_HOST="testserver"
"{}/language/{}/".format(API_V2, uppercase_name),
headers={"host": "testserver"},
)
self.assertEqual(uppercase_response.status_code, status.HTTP_200_OK)

Expand Down
6 changes: 3 additions & 3 deletions pokemon_v2/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.urls import include, path, re_path

#####################################
#
Expand Down Expand Up @@ -70,8 +70,8 @@
###########################

urlpatterns = [
url(r"^api/v2/", include(router.urls)),
url(
path("api/v2/", include(router.urls)),
re_path(
r"^api/v2/pokemon/(?P<pokemon_id>\d+)/encounters",
PokemonEncounterView.as_view(),
name="pokemon_encounters",
Expand Down
22 changes: 10 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
Django==3.2.25
Django==4.2.27
Unipath==1.1
coverage==4.5.4
django-cors-headers==3.14.0
django-discover-runner==1.0
django-redis==4.12.1
django-cachalot==2.4.5
djangorestframework==3.14.0
coverage==7.13.1
django-cors-headers==4.9.0
django-redis==6.0.0
django-cachalot==2.8.0
djangorestframework==3.16.1
gunicorn==23.0.0
mimeparse==0.1.3
psycopg2-binary==2.9.10
python-dateutil==2.8.2
python-mimeparse==1.6.0
drf-spectacular==0.28.0
psycopg[binary]==3.3.2
python-dateutil==2.9.0
python-mimeparse==2.0.0
drf-spectacular==0.29.0
legacy-cgi; python_version >= '3.13'
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r requirements.txt
black==23.12.1
black==26.1.0