notifications-api-common 0.7.2__tar.gz → 0.7.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/CHANGELOG.rst +14 -0
  2. {notifications_api_common-0.7.2/notifications_api_common.egg-info → notifications_api_common-0.7.3}/PKG-INFO +9 -12
  3. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/README.rst +7 -6
  4. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/api/serializers.py +1 -1
  5. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/contrib/setup_configuration/models.py +4 -1
  6. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/locale/en/LC_MESSAGES/django.po +1 -1
  7. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/locale/nl/LC_MESSAGES/django.po +1 -1
  8. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/settings.py +2 -0
  9. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/utils.py +1 -1
  10. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/validators.py +6 -1
  11. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3/notifications_api_common.egg-info}/PKG-INFO +9 -12
  12. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common.egg-info/SOURCES.txt +2 -1
  13. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common.egg-info/requires.txt +1 -6
  14. notifications_api_common-0.7.3/pyproject.toml +126 -0
  15. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/setup.cfg +3 -28
  16. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/tests/test_configuration_steps.py +4 -5
  17. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/tests/test_register_kanalen.py +0 -2
  18. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/tests/test_send_message.py +2 -2
  19. notifications_api_common-0.7.3/tests/test_validators.py +23 -0
  20. notifications_api_common-0.7.2/pyproject.toml +0 -3
  21. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/LICENSE +0 -0
  22. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/MANIFEST.in +0 -0
  23. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/__init__.py +0 -0
  24. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/admin.py +0 -0
  25. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/api/__init__.py +0 -0
  26. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/apps.py +0 -0
  27. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/autoretry.py +0 -0
  28. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/constants.py +0 -0
  29. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/contrib/__init__.py +0 -0
  30. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/contrib/setup_configuration/__init__.py +0 -0
  31. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/contrib/setup_configuration/steps.py +0 -0
  32. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/kanalen.py +0 -0
  33. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/locale/en/LC_MESSAGES/django.mo +0 -0
  34. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/locale/nl/LC_MESSAGES/django.mo +0 -0
  35. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/management/__init__.py +0 -0
  36. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/management/commands/__init__.py +0 -0
  37. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/management/commands/generate_notificaties.py +0 -0
  38. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/management/commands/register_kanalen.py +0 -0
  39. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0001_initial.py +0 -0
  40. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0002_notificationsconfig_notifications_api_service.py +0 -0
  41. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0003_migrate_api_root.py +0 -0
  42. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0004_remove_notificationsconfig_api_root.py +0 -0
  43. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0005_auto_20220810_0950.py +0 -0
  44. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0006_auto_20221018_1406.py +0 -0
  45. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0006_auto_20221213_0214.py +0 -0
  46. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0007_auto_20221206_0414.py +0 -0
  47. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0008_merge_0006_auto_20221213_0214_0007_auto_20221206_0414.py +0 -0
  48. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/0009_add_subscription_identifier.py +0 -0
  49. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/migrations/__init__.py +0 -0
  50. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/models.py +0 -0
  51. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/py.typed +0 -0
  52. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/query.py +0 -0
  53. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/tasks.py +0 -0
  54. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/templates/notifications_api_common/kanalen.html +0 -0
  55. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/templates/notifications_api_common/notificaties.md +0 -0
  56. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/tests/__init__.py +0 -0
  57. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/tests/utils.py +0 -0
  58. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/urls.py +0 -0
  59. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/views.py +0 -0
  60. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common/viewsets.py +0 -0
  61. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common.egg-info/dependency_links.txt +0 -0
  62. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common.egg-info/not-zip-safe +0 -0
  63. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/notifications_api_common.egg-info/top_level.txt +0 -0
  64. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/setup.py +0 -0
  65. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/tests/test_generate_notificaties.py +0 -0
  66. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/tests/test_kanaal_documentation.py +0 -0
  67. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/tests/test_register_webhook.py +0 -0
  68. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/tests/test_subscription_configuration_steps.py +0 -0
  69. {notifications_api_common-0.7.2 → notifications_api_common-0.7.3}/tests/test_utils.py +0 -0
@@ -2,6 +2,20 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
+ 0.7.3 (2025-06-17)
6
+ ------------------
7
+
8
+ **New features**
9
+
10
+ * [#37] Set the ``notifications_api_service_identifier`` field as required in setup-configuration
11
+ * Add the env variable ``TIME_LEEWAY`` that defines a leeway in ``UntilNowValidator``
12
+
13
+ **Maintenance**
14
+
15
+ * [maykinmedia/open-api-framework#132] Replace ``check_sphinx.py`` with ``make``
16
+ * [maykinmedia/open-api-framework#133] Replace ``black``, ``isort`` and ``flake8`` with ``ruff`` and update code-quality workflow
17
+ * [maykinmedia/open-api-framework#140] Upgrade python to 3.12
18
+
5
19
  0.7.2 (2025-03-28)
6
20
  ------------------
7
21
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notifications-api-common
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: Re-usable integration layer for the Common Ground Notifications API specification.
5
5
  Home-page: https://github.com/maykinmedia/notifications-api-common
6
6
  Author: Maykin Media
@@ -37,12 +37,8 @@ Requires-Dist: pytest; extra == "tests"
37
37
  Requires-Dist: pytest-django; extra == "tests"
38
38
  Requires-Dist: freezegun; extra == "tests"
39
39
  Requires-Dist: tox; extra == "tests"
40
- Requires-Dist: isort; extra == "tests"
41
- Requires-Dist: black; extra == "tests"
42
- Requires-Dist: flake8; extra == "tests"
40
+ Requires-Dist: ruff; extra == "tests"
43
41
  Requires-Dist: zgw-consumers[testutils]>=0.35.1; extra == "tests"
44
- Provides-Extra: pep8
45
- Requires-Dist: flake8; extra == "pep8"
46
42
  Provides-Extra: coverage
47
43
  Requires-Dist: pytest-cov; extra == "coverage"
48
44
  Provides-Extra: setup-configuration
@@ -59,12 +55,12 @@ Dynamic: license-file
59
55
  notifications-api-common
60
56
  ========================
61
57
 
62
- :Version: 0.7.2
58
+ :Version: 0.7.3
63
59
  :Source: https://github.com/maykinmedia/notifications-api-common
64
60
  :Keywords: notifications, REST, API, Common Ground, ZGW
65
- :PythonVersion: 3.10
61
+ :PythonVersion: 3.12
66
62
 
67
- |build-status| |code-quality| |black| |coverage| |docs|
63
+ |build-status| |code-quality| |ruff| |coverage| |docs|
68
64
 
69
65
  |python-versions| |django-versions| |pypi-version|
70
66
 
@@ -115,9 +111,10 @@ See the `documentation <https://notifications-api-common.readthedocs.io/>`_.
115
111
  :alt: Code quality checks
116
112
  :target: https://github.com/maykinmedia/notifications-api-common/actions?query=workflow%3A%22Code+quality+checks%22
117
113
 
118
- .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
119
- :target: https://github.com/psf/black
120
-
114
+ .. |ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
115
+ :target: https://github.com/astral-sh/ruff
116
+ :alt: Ruff
117
+
121
118
  .. |coverage| image:: https://codecov.io/gh/maykinmedia/notifications-api-common/branch/main/graph/badge.svg
122
119
  :target: https://codecov.io/gh/maykinmedia/notifications-api-common
123
120
  :alt: Coverage status
@@ -1,12 +1,12 @@
1
1
  notifications-api-common
2
2
  ========================
3
3
 
4
- :Version: 0.7.2
4
+ :Version: 0.7.3
5
5
  :Source: https://github.com/maykinmedia/notifications-api-common
6
6
  :Keywords: notifications, REST, API, Common Ground, ZGW
7
- :PythonVersion: 3.10
7
+ :PythonVersion: 3.12
8
8
 
9
- |build-status| |code-quality| |black| |coverage| |docs|
9
+ |build-status| |code-quality| |ruff| |coverage| |docs|
10
10
 
11
11
  |python-versions| |django-versions| |pypi-version|
12
12
 
@@ -57,9 +57,10 @@ See the `documentation <https://notifications-api-common.readthedocs.io/>`_.
57
57
  :alt: Code quality checks
58
58
  :target: https://github.com/maykinmedia/notifications-api-common/actions?query=workflow%3A%22Code+quality+checks%22
59
59
 
60
- .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
61
- :target: https://github.com/psf/black
62
-
60
+ .. |ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
61
+ :target: https://github.com/astral-sh/ruff
62
+ :alt: Ruff
63
+
63
64
  .. |coverage| image:: https://codecov.io/gh/maykinmedia/notifications-api-common/branch/main/graph/badge.svg
64
65
  :target: https://codecov.io/gh/maykinmedia/notifications-api-common
65
66
  :alt: Coverage status
@@ -28,7 +28,7 @@ class NotificatieSerializer(serializers.Serializer):
28
28
  )
29
29
  resource_url = serializers.URLField(
30
30
  label=_("resource URL"),
31
- help_text=_("URL-referentie naar de `resource` van de publicerende " "API."),
31
+ help_text=_("URL-referentie naar de `resource` van de publicerende API."),
32
32
  )
33
33
  actie = serializers.CharField(
34
34
  label=_("actie"),
@@ -6,7 +6,10 @@ from notifications_api_common.models import NotificationsConfig, Subscription
6
6
 
7
7
  class NotificationConfigurationModel(ConfigurationModel):
8
8
  notifications_api_service_identifier: str = DjangoModelRef(
9
- NotificationsConfig, "notifications_api_service", examples=["notificaties-api"]
9
+ NotificationsConfig,
10
+ "notifications_api_service",
11
+ examples=["notificaties-api"],
12
+ default=...,
10
13
  )
11
14
 
12
15
  class Meta:
@@ -6,7 +6,7 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: 0.7.2\n"
9
+ "Project-Id-Version: 0.7.3\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
11
  "POT-Creation-Date: 2024-12-12 15:28+0100\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
@@ -6,7 +6,7 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: 0.7.2\n"
9
+ "Project-Id-Version: 0.7.3\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
11
  "POT-Creation-Date: 2024-12-12 15:28+0100\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
@@ -11,6 +11,8 @@ NOTIFICATIONS_GUARANTEE_DELIVERY = True
11
11
 
12
12
  NOTIFICATIONS_API_GET_DOMAIN = "notifications_api_common.utils.get_site_domain"
13
13
 
14
+ TIME_LEEWAY = 0
15
+
14
16
 
15
17
  def get_setting(name: str) -> Any:
16
18
  this_module = sys.modules[__name__]
@@ -22,7 +22,7 @@ def notification_documentation(kanaal: Kanaal):
22
22
  **Resources en acties**
23
23
  """
24
24
  for resource, actions in kanaal.get_usage():
25
- doc += f"""- `{resource}`: {', '.join(actions)}\n"""
25
+ doc += f"""- `{resource}`: {", ".join(actions)}\n"""
26
26
  return doc
27
27
 
28
28
 
@@ -1,10 +1,13 @@
1
1
  import logging
2
+ from datetime import timedelta
2
3
 
3
4
  from django.core.exceptions import ValidationError
4
5
  from django.utils import timezone
5
6
  from django.utils.deconstruct import deconstructible
6
7
  from django.utils.translation import gettext_lazy as _
7
8
 
9
+ from .settings import get_setting
10
+
8
11
  logger = logging.getLogger(__name__)
9
12
 
10
13
 
@@ -14,6 +17,8 @@ class UntilNowValidator:
14
17
  Validate a datetime to not be in the future.
15
18
 
16
19
  This means that `now` is included.
20
+
21
+ Some leeway can be added with the TIME_LEEWAY setting.
17
22
  """
18
23
 
19
24
  message = _("Ensure this value is not in the future.")
@@ -21,7 +26,7 @@ class UntilNowValidator:
21
26
 
22
27
  @property
23
28
  def limit_value(self):
24
- return timezone.now()
29
+ return timezone.now() + timedelta(seconds=get_setting("TIME_LEEWAY"))
25
30
 
26
31
  def __call__(self, value):
27
32
  if value > self.limit_value:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notifications-api-common
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: Re-usable integration layer for the Common Ground Notifications API specification.
5
5
  Home-page: https://github.com/maykinmedia/notifications-api-common
6
6
  Author: Maykin Media
@@ -37,12 +37,8 @@ Requires-Dist: pytest; extra == "tests"
37
37
  Requires-Dist: pytest-django; extra == "tests"
38
38
  Requires-Dist: freezegun; extra == "tests"
39
39
  Requires-Dist: tox; extra == "tests"
40
- Requires-Dist: isort; extra == "tests"
41
- Requires-Dist: black; extra == "tests"
42
- Requires-Dist: flake8; extra == "tests"
40
+ Requires-Dist: ruff; extra == "tests"
43
41
  Requires-Dist: zgw-consumers[testutils]>=0.35.1; extra == "tests"
44
- Provides-Extra: pep8
45
- Requires-Dist: flake8; extra == "pep8"
46
42
  Provides-Extra: coverage
47
43
  Requires-Dist: pytest-cov; extra == "coverage"
48
44
  Provides-Extra: setup-configuration
@@ -59,12 +55,12 @@ Dynamic: license-file
59
55
  notifications-api-common
60
56
  ========================
61
57
 
62
- :Version: 0.7.2
58
+ :Version: 0.7.3
63
59
  :Source: https://github.com/maykinmedia/notifications-api-common
64
60
  :Keywords: notifications, REST, API, Common Ground, ZGW
65
- :PythonVersion: 3.10
61
+ :PythonVersion: 3.12
66
62
 
67
- |build-status| |code-quality| |black| |coverage| |docs|
63
+ |build-status| |code-quality| |ruff| |coverage| |docs|
68
64
 
69
65
  |python-versions| |django-versions| |pypi-version|
70
66
 
@@ -115,9 +111,10 @@ See the `documentation <https://notifications-api-common.readthedocs.io/>`_.
115
111
  :alt: Code quality checks
116
112
  :target: https://github.com/maykinmedia/notifications-api-common/actions?query=workflow%3A%22Code+quality+checks%22
117
113
 
118
- .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
119
- :target: https://github.com/psf/black
120
-
114
+ .. |ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
115
+ :target: https://github.com/astral-sh/ruff
116
+ :alt: Ruff
117
+
121
118
  .. |coverage| image:: https://codecov.io/gh/maykinmedia/notifications-api-common/branch/main/graph/badge.svg
122
119
  :target: https://codecov.io/gh/maykinmedia/notifications-api-common
123
120
  :alt: Coverage status
@@ -63,4 +63,5 @@ tests/test_register_kanalen.py
63
63
  tests/test_register_webhook.py
64
64
  tests/test_send_message.py
65
65
  tests/test_subscription_configuration_steps.py
66
- tests/test_utils.py
66
+ tests/test_utils.py
67
+ tests/test_validators.py
@@ -16,9 +16,6 @@ psycopg2
16
16
  sphinx
17
17
  sphinx-rtd-theme
18
18
 
19
- [pep8]
20
- flake8
21
-
22
19
  [release]
23
20
  bumpversion
24
21
  twine
@@ -33,7 +30,5 @@ pytest
33
30
  pytest-django
34
31
  freezegun
35
32
  tox
36
- isort
37
- black
38
- flake8
33
+ ruff
39
34
  zgw-consumers[testutils]>=0.35.1
@@ -0,0 +1,126 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 30.3.0"] # version supporting setup.cfg]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ # Bumpversion configuration
6
+
7
+ [tool.bumpversion]
8
+ commit = false
9
+ tag = false
10
+ current_version = "0.7.3"
11
+
12
+ [[tool.bumpversion.files]]
13
+ filename = "setup.cfg"
14
+
15
+ [[tool.bumpversion.files]]
16
+ filename = "README.rst"
17
+
18
+ [[tool.bumpversion.files]]
19
+ filename = "docs/conf.py"
20
+
21
+ [[tool.bumpversion.files]]
22
+ filename = "notifications_api_common/locale/en/LC_MESSAGES/django.po"
23
+
24
+ [[tool.bumpversion.files]]
25
+ filename = "notifications_api_common/locale/nl/LC_MESSAGES/django.po"
26
+
27
+ [tool.ruff]
28
+ # Exclude folders and files
29
+ exclude = [
30
+ "migrations",
31
+ "static",
32
+ "media",
33
+ ]
34
+
35
+ # Same as Black
36
+ line-length = 88
37
+ indent-width = 4
38
+
39
+ target-version = "py312"
40
+
41
+ [tool.ruff.lint]
42
+ select = [
43
+ # https://docs.astral.sh/ruff/rules/#isort-i
44
+ "I",
45
+ # https://docs.astral.sh/ruff/rules/#error-e
46
+ "E",
47
+ # https://docs.astral.sh/ruff/rules/#pyflakes-f
48
+ "F",
49
+ # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
50
+ "SIM",
51
+ # https://docs.astral.sh/ruff/rules/#perflint-perf
52
+ "PERF",
53
+ # https://docs.astral.sh/ruff/rules/#refurb-furb
54
+ "FURB",
55
+ # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
56
+ "B006",
57
+ "B010",
58
+ # https://docs.astral.sh/ruff/rules/#pep8-naming-n
59
+ "N",
60
+ ]
61
+
62
+ ignore = [
63
+ # Checks for assertRaises and pytest.raises context managers that catch Exception or BaseException.
64
+ "B017",
65
+ # Checks for useless expressions.
66
+ "B018",
67
+ # Checks for raise statements in exception handlers that lack a from clause.
68
+ "B904",
69
+ # Whitespace before ':' (conflicts with Black)
70
+ "E203",
71
+ # Checks for lines that exceed the specified maximum character length.
72
+ "E501",
73
+ # Do not assign a lambda expression
74
+ "E731",
75
+ # Name may be undefined from '*' import
76
+ "F405",
77
+ # Checks for CamelCase imports that are aliased to lowercase names
78
+ "N813",
79
+ # Checks for CamelCase imports that are aliased to constant-style names.
80
+ "N814",
81
+ # Checks for class variable names that follow the mixedCase convention
82
+ "N815",
83
+ # Exception name should be named with Error suffix
84
+ "N818",
85
+ # Checks for instance methods that use a name other than self for their first argument.
86
+ "N805",
87
+ # Checks for the use of non-lowercase variable names in functions
88
+ "N806",
89
+ # Checks for functions names that do not follow the snake_case naming convention.
90
+ "N802",
91
+ # Checks for module names that do not follow the snake_case naming convention or are otherwise invalid.
92
+ "N999",
93
+ # Checks for for loops that can be replaced by a list comprehension.
94
+ "PERF401",
95
+ # Checks for `if` statements that can be replaced with bool
96
+ "SIM103",
97
+ # Check for if-else-blocks that can be replaced with a ternary operator
98
+ "SIM108",
99
+ #Check for environment variables that are not capitalized.
100
+ "SIM112",
101
+ # Checks for nested if statements that can be collapsed into a single if statement
102
+ "SIM102",
103
+ # Use a single `with` statement with multiple contexts instead of nested `with` statements
104
+ "SIM117",
105
+ ]
106
+
107
+
108
+ # Import sorting configuration (equivalent to isort)
109
+ [tool.ruff.lint.isort]
110
+ combine-as-imports = true
111
+ force-wrap-aliases = false
112
+ known-first-party = ["notifications_api_common"]
113
+ lines-after-imports = -1
114
+ relative-imports-order = "furthest-to-closest"
115
+ sections = { django = ["django"] }
116
+ section-order = [
117
+ "future",
118
+ "standard-library",
119
+ "django",
120
+ "third-party",
121
+ "first-party",
122
+ "local-folder",
123
+ ]
124
+
125
+ [tool.ruff.format]
126
+ line-ending = "lf"
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = notifications-api-common
3
- version = 0.7.2
3
+ version = 0.7.3
4
4
  description = Re-usable integration layer for the Common Ground Notifications API specification.
5
5
  long_description = file: README.rst
6
6
  url = https://github.com/maykinmedia/notifications-api-common
@@ -43,9 +43,7 @@ tests_require =
43
43
  pytest-django
44
44
  freezegun
45
45
  tox
46
- isort
47
- black
48
- flake8
46
+ ruff
49
47
  zgw-consumers[testutils]>=0.35.1
50
48
 
51
49
  [options.packages.find]
@@ -62,11 +60,8 @@ tests =
62
60
  pytest-django
63
61
  freezegun
64
62
  tox
65
- isort
66
- black
67
- flake8
63
+ ruff
68
64
  zgw-consumers[testutils]>=0.35.1
69
- pep8 = flake8
70
65
  coverage = pytest-cov
71
66
  setup-configuration =
72
67
  django-setup-configuration>=0.7.0
@@ -81,30 +76,10 @@ release =
81
76
  [aliases]
82
77
  test = pytest
83
78
 
84
- [isort]
85
- combine_as_imports = true
86
- default_section = THIRDPARTY
87
- include_trailing_comma = true
88
- line_length = 88
89
- multi_line_output = 3
90
- force_grid_wrap = 0
91
- use_parentheses = True
92
- ensure_newline_before_comments = True
93
- skip = env,.tox,.history,.eggs
94
- known_django = django
95
- known_first_party = notifications_api_common
96
- sections = FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
97
-
98
79
  [tool:pytest]
99
80
  testpaths = tests
100
81
  DJANGO_SETTINGS_MODULE = testapp.settings
101
82
 
102
- [pep8]
103
-
104
- [flake8]
105
- max-line-length = 88
106
- exclude = env,.tox,doc
107
-
108
83
  [egg_info]
109
84
  tag_build =
110
85
  tag_date = 0
@@ -57,16 +57,15 @@ def test_execute_configuration_step_update_existing():
57
57
 
58
58
 
59
59
  @pytest.mark.django_db
60
- def test_execute_configuration_step_without_service_success():
60
+ def test_execute_configuration_step_without_service_is_not_allowed():
61
61
  with pytest.raises(PrerequisiteFailed) as excinfo:
62
62
  execute_single_step(
63
63
  NotificationConfigurationStep, yaml_source=CONFIG_FILE_PATH_NO_SERVICE
64
64
  )
65
65
 
66
- assert (
67
- "notifications_config.notifications_api_service_identifier\n Input should be a valid string"
68
- in str(excinfo.value)
69
- )
66
+ assert "notifications_api_service_identifier" in str(excinfo.value)
67
+ assert "validation error" in str(excinfo.value)
68
+ assert "Field required" in str(excinfo.value)
70
69
 
71
70
 
72
71
  @pytest.mark.django_db
@@ -1,7 +1,6 @@
1
1
  from io import StringIO
2
2
  from unittest.mock import Mock
3
3
 
4
- from django.test import override_settings
5
4
  from django.test.testcases import call_command
6
5
 
7
6
  import pytest
@@ -16,7 +15,6 @@ KANALEN_LIST_URL = (furl(NOTIFICATIONS_API_ROOT) / "kanaal").url
16
15
 
17
16
  @pytest.fixture
18
17
  def override_kanalen():
19
-
20
18
  kanalen = set(
21
19
  (
22
20
  Kanaal(
@@ -117,7 +117,7 @@ def test_api_create_person_unconfigured(api_client, notifications_config):
117
117
  data = {"name": "John", "address_street": "Grotestraat", "address_number": "1"}
118
118
 
119
119
  with pytest.raises(RuntimeError):
120
- response = api_client.post(url, data)
120
+ api_client.post(url, data)
121
121
 
122
122
  assert Person.objects.count() == 0
123
123
 
@@ -132,6 +132,6 @@ def test_api_create_person_unconfigured_notifications_guarantee_delivery_false(
132
132
  url = reverse("person-list")
133
133
  data = {"name": "John", "address_street": "Grotestraat", "address_number": "1"}
134
134
 
135
- response = api_client.post(url, data)
135
+ api_client.post(url, data)
136
136
 
137
137
  assert Person.objects.count() == 1
@@ -0,0 +1,23 @@
1
+ from datetime import datetime
2
+
3
+ from django.core.exceptions import ValidationError
4
+
5
+ import pytest
6
+ from freezegun import freeze_time
7
+
8
+ from notifications_api_common.validators import UntilNowValidator
9
+
10
+
11
+ @freeze_time("2021-08-23T14:20:00")
12
+ def test_invalid_date():
13
+ validator = UntilNowValidator()
14
+ with pytest.raises(ValidationError) as error:
15
+ validator(datetime(2021, 8, 23, 14, 20, 4))
16
+ assert "Ensure this value is not in the future." in str(error.value)
17
+
18
+
19
+ @freeze_time("2021-08-23T14:20:00")
20
+ def test_invalid_date_with_leeway(settings):
21
+ settings.TIME_LEEWAY = 5
22
+ validator = UntilNowValidator()
23
+ validator(datetime(2021, 8, 23, 14, 20, 4))
@@ -1,3 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools >= 30.3.0"] # version supporting setup.cfg]
3
- build-backend = "setuptools.build_meta"