Skip to content

Commit

Permalink
chore: Fix warnings (#352)
Browse files Browse the repository at this point in the history
* Move bibliography app config to `apps.py`

* Replace `url` with `re_path`

`url` is deprecated: https://docs.djangoproject.com/en/3.2/ref/urls/#url

* Replace usage of deprecated `assertEquals`

* Treat warnings as testing errors

* Set value for `WAGTAILADMIN_BASE_URL` in devel

---------

Co-authored-by: Alex Morega <[email protected]>
  • Loading branch information
mgax and mgax authored Dec 4, 2023
1 parent 72f1fcb commit 1024671
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 33 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ services:
- "${DOCKER_APPLICATION_PORT:-8001}:8000"
env_file:
- docker/dev.env
environment:
WAGTAILADMIN_BASE_URL: "http://localhost:${DOCKER_APPLICATION_PORT:-8001}/"
depends_on:
- database
- memcached
Expand Down
11 changes: 0 additions & 11 deletions ietf/bibliography/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
from django.apps import AppConfig


class BibliographyAppConfig(AppConfig):
name = 'ietf.bibliography'
verbose_name = "Bibliography items"


default_app_config = 'ietf.bibliography.BibliographyAppConfig'


# TODO:
# X bibliography item model with generic foreign key
# item rendering method
Expand Down
6 changes: 6 additions & 0 deletions ietf/bibliography/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BibliographyAppConfig(AppConfig):
name = 'ietf.bibliography'
verbose_name = "Bibliography items"
8 changes: 4 additions & 4 deletions ietf/bibliography/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import url
from django.urls import re_path

from .views import (
referenced_types,
Expand All @@ -8,7 +8,7 @@


urlpatterns = [
url(r'^referenced_types/$', referenced_types, name='referenced_types'),
url(r'^referenced_objects/(\d+)/$', referenced_objects, name='referenced_objects'),
url(r'^referencing_pages/(\d+)/(\d+)/$', referencing_pages, name='referencing_pages'),
re_path(r'^referenced_types/$', referenced_types, name='referenced_types'),
re_path(r'^referenced_objects/(\d+)/$', referenced_objects, name='referenced_objects'),
re_path(r'^referencing_pages/(\d+)/(\d+)/$', referencing_pages, name='referencing_pages'),
]
4 changes: 2 additions & 2 deletions ietf/blog/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def test_previous_next_links_correct(self):
self.assertTrue(self.prevblog.date < self.blog.date)
self.assertTrue(self.nextblog.date > self.blog.date)
blog = BlogPage.objects.get(pk=self.blog.pk)
self.assertEquals(self.prevblog, blog.previous)
self.assertEquals(self.nextblog, blog.next)
self.assertEqual(self.prevblog, blog.previous)
self.assertEqual(self.nextblog, blog.next)

def test_blog_feed(self):
r = self.client.get(path='/blog/feed/')
Expand Down
1 change: 1 addition & 0 deletions ietf/settings/docker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
StringVariable("AWS_STORAGE_BUCKET_NAME", default=""), # S3 Bucket Name
StringVariable("AWS_S3_CUSTOM_DOMAIN", default=""), # S3 Domain
StringVariable("DATABASE_URL"), # e.g. postgres URL
StringListVariable("WAGTAILADMIN_BASE_URL", default=""),
]

_DJANGO_ENVVARS = [
Expand Down
4 changes: 2 additions & 2 deletions ietf/snippets/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.conf.urls import url
from django.urls import re_path

from .views import disclaimer


urlpatterns = [
url(r'^disclaimer/(\d+)/$', disclaimer, name='disclaimer'),
re_path(r'^disclaimer/(\d+)/$', disclaimer, name='disclaimer'),
]
28 changes: 14 additions & 14 deletions ietf/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls import include
from django.contrib import admin
from django.urls import path
from django.urls import path, re_path
from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.contrib.sitemaps.views import sitemap
Expand All @@ -17,14 +17,14 @@

urlpatterns = [
path("sitemap.xml", sitemap),
url(r"^admin/doc/", include("django.contrib.admindocs.urls")),
url(r"^bibliography/", include(bibliography_urls)),
url(r"^django-admin/", admin.site.urls),
url(r"^blog/feed/$", BlogFeed(), name="blog_feed"),
url(r"^blog/(?P<topic>.+)/feed/$", TopicBlogFeed(), name="blog_feed_with_topic"),
url(r"^admin/", include(wagtailadmin_urls)),
url(r"^documents/", include(wagtaildocs_urls)),
url(r"^search/$", search, name="search"),
re_path(r"^admin/doc/", include("django.contrib.admindocs.urls")),
re_path(r"^bibliography/", include(bibliography_urls)),
re_path(r"^django-admin/", admin.site.urls),
re_path(r"^blog/feed/$", BlogFeed(), name="blog_feed"),
re_path(r"^blog/(?P<topic>.+)/feed/$", TopicBlogFeed(), name="blog_feed_with_topic"),
re_path(r"^admin/", include(wagtailadmin_urls)),
re_path(r"^documents/", include(wagtaildocs_urls)),
re_path(r"^search/$", search, name="search"),
]


Expand All @@ -39,12 +39,12 @@

# Add views for testing 404 and 500 templates
urlpatterns += [
url(r"^test404/$", TemplateView.as_view(template_name="404.html")),
url(r"^test500/$", TemplateView.as_view(template_name="500.html")),
re_path(r"^test404/$", TemplateView.as_view(template_name="404.html")),
re_path(r"^test500/$", TemplateView.as_view(template_name="500.html")),
]


urlpatterns += [
url(r"^misc/", include(snippet_urls)),
url(r"", include(wagtail_urls)),
re_path(r"^misc/", include(snippet_urls)),
re_path(r"", include(wagtail_urls)),
]
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[tool.pytest.ini_options]
addopts = "--reuse-db"
python_files = "ietf/*/test*.py"
filterwarnings = [
"error",
"ignore::UserWarning",
]

0 comments on commit 1024671

Please sign in to comment.