From 4d82c76fbd6ee5152a90768dc120c42060ed1525 Mon Sep 17 00:00:00 2001 From: shagi Date: Thu, 26 Oct 2023 16:13:00 +0200 Subject: [PATCH] fix: fix gas urls, bump version 0.8.9 --- changelog.md | 5 +++++ gas/sites.py | 2 +- gas/tests/test_gas_views.py | 30 ++++++++++++++++++++++++++++++ setup.cfg | 2 +- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 gas/tests/test_gas_views.py diff --git a/changelog.md b/changelog.md index 3abb998..af5ba8f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ Changelog ========= +0.8.9 +----- + +* Bugfix + 0.8.8 ----- diff --git a/gas/sites.py b/gas/sites.py index 2ffb9a7..dea51f9 100644 --- a/gas/sites.py +++ b/gas/sites.py @@ -86,7 +86,7 @@ class GASSite: for prefix, urls in self._registry['urls'].items(): if prefix: urlpatterns.append( - re_path(r'^{prefix}/', include(urls)), + re_path(f'^{prefix}/', include(urls)), ) else: urlpatterns.append( diff --git a/gas/tests/test_gas_views.py b/gas/tests/test_gas_views.py new file mode 100644 index 0000000..0e1e4ee --- /dev/null +++ b/gas/tests/test_gas_views.py @@ -0,0 +1,30 @@ +from django.test import TestCase, Client +from django.urls import reverse + +from model_bakery import baker + +from gas.gas.core.views import GASLoginView + + +class GASLoginTestCase(TestCase): + def test_load(self): + client = Client() + response = client.get(reverse('gas:login')) + self.assertEqual(response.status_code, 200) + + +class IndexTestCase(TestCase): + def test_load(self): + admin_user = baker.make( + 'auth.User', + username='admin', + is_superuser=True, + ) + + client = Client() + response = client.get(reverse('gas:index')) + self.assertEqual(response.status_code, 302) + + client.force_login(admin_user) + response = client.get(reverse('gas:index')) + self.assertEqual(response.status_code, 200) diff --git a/setup.cfg b/setup.cfg index f546cc9..0e24c96 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = django-gas -version = 0.8.8 +version = 0.8.9 description = An alternative to django admin long_description = file: readme.md, changelog.md, collaborators.md long_description_content_type = text/markdown