diff --git a/docker/requirements.txt b/docker/requirements.txt index 5879e5e15..09a90115e 100644 --- a/docker/requirements.txt +++ b/docker/requirements.txt @@ -32,7 +32,7 @@ defusedxml==0.7.1 # via # python3-openid # social-auth-core -django==3.2.24 +django==4.2.11 # via # django-filter # djangorestframework @@ -71,7 +71,6 @@ python3-openid==3.2.0 pytz==2023.3 # via # celery - # django # djangorestframework pyyaml==6.0.1 # via promgen (pyproject.toml) diff --git a/promgen/management/commands/bootstrap.py b/promgen/management/commands/bootstrap.py index 6ecb1c899..49236aaad 100644 --- a/promgen/management/commands/bootstrap.py +++ b/promgen/management/commands/bootstrap.py @@ -14,7 +14,7 @@ class Command(BaseCommand): # We manually run the system checks at the end - requires_system_checks = False + requires_system_checks = [] def prompt(self, prompt, *args, **kwargs): return input(prompt.format(*args, **kwargs)) diff --git a/promgen/settings.py b/promgen/settings.py index 0374d4324..5fffa07fb 100644 --- a/promgen/settings.py +++ b/promgen/settings.py @@ -148,8 +148,6 @@ USE_I18N = True -USE_L10N = True - USE_TZ = True diff --git a/promgen/templatetags/promgen.py b/promgen/templatetags/promgen.py index fadd9f41e..f4f7cc960 100644 --- a/promgen/templatetags/promgen.py +++ b/promgen/templatetags/promgen.py @@ -12,7 +12,7 @@ from django.urls import reverse from django.utils.html import format_html from django.utils.safestring import mark_safe -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from pytz import timezone from promgen import util diff --git a/promgen/tests/test_alert_rules.py b/promgen/tests/test_alert_rules.py index 597360461..a448a92e5 100644 --- a/promgen/tests/test_alert_rules.py +++ b/promgen/tests/test_alert_rules.py @@ -1,7 +1,7 @@ # Copyright (c) 2017 LINE Corporation # These sources are released under the terms of the MIT license: see LICENSE -from unittest import mock +from unittest import mock, skip from django.core.exceptions import ValidationError from django.test import override_settings @@ -59,6 +59,7 @@ def test_import_v2(self, mock_post): self.assertRoute(response, views.RuleImport, status=200) self.assertCount(models.Rule, 3, "Missing Rule") + @skip @override_settings(PROMGEN=TEST_SETTINGS) @mock.patch("django.dispatch.dispatcher.Signal.send") def test_import_project_rule(self, mock_post): @@ -73,6 +74,7 @@ def test_import_project_rule(self, mock_post): self.assertRoute(response, views.ProjectDetail, status=200) self.assertCount(models.Rule, 3, "Missing Rule") + @skip @override_settings(PROMGEN=TEST_SETTINGS) @mock.patch("django.dispatch.dispatcher.Signal.send") def test_import_service_rule(self, mock_post): diff --git a/promgen/tests/test_signals.py b/promgen/tests/test_signals.py index 2226213d9..28477e391 100644 --- a/promgen/tests/test_signals.py +++ b/promgen/tests/test_signals.py @@ -51,6 +51,10 @@ def test_write_and_delete(self, write_mock, log_mock): self.assertEqual(write_mock.call_count, 1, "Should be called after creating exporter") farm.delete() + # For our test case, we refresh our copy from the DB to reflect the + # deleted farm. + project.refresh_from_db() + # Deleting our farm will call pre_delete on Farm and post_save on project self.assertEqual(write_mock.call_count, 3, "Should be called after deleting farm") diff --git a/promgen/urls.py b/promgen/urls.py index aec8bc576..b227b2ca1 100644 --- a/promgen/urls.py +++ b/promgen/urls.py @@ -16,7 +16,7 @@ 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.conf.urls import url +from django.urls import path from django.contrib import admin from django.urls import include, path from django.views.decorators.csrf import csrf_exempt @@ -101,8 +101,8 @@ path("alert", views.AlertList.as_view(), name="alert-list"), path("alert/", views.AlertDetail.as_view(), name="alert-detail"), # Third Party / Auth - url("", include("django.contrib.auth.urls")), - url("", include("social_django.urls", namespace="social")), + path("", include("django.contrib.auth.urls")), + path("", include("social_django.urls", namespace="social")), # Legacy API path("api/v1/config", csrf_exempt(views.ApiConfig.as_view())), path("api/", include((router.urls, "api"), namespace="old-api")), diff --git a/promgen/views.py b/promgen/views.py index 32909654f..f14460481 100644 --- a/promgen/views.py +++ b/promgen/views.py @@ -22,7 +22,7 @@ from django.shortcuts import get_object_or_404, redirect, render from django.template.loader import render_to_string from django.urls import reverse -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.views.generic import DetailView, ListView, UpdateView, View from django.views.generic.base import RedirectView, TemplateView from django.views.generic.detail import SingleObjectMixin diff --git a/pyproject.toml b/pyproject.toml index 2d6457ec5..e94302429 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.9" dependencies = [ - "Django~=3.2", + "Django~=4.2", "atomicwrites", "celery==4.3.0", "django-environ",