Skip to content

Commit 3c61053

Browse files
committed
[admin] Ensure preview button is present
1 parent 7edf51a commit 3c61053

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

README.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ If you want to contribute, install your cloned fork:
7272
Setup (integrate in an existing django project)
7373
-----------------------------------------------
7474

75-
``INSTALLED_APPS`` in ``settings.py`` should look like the following:
75+
``INSTALLED_APPS`` in ``settings.py`` should look like the following (ordering is important):
7676

7777
.. code-block:: python
7878
@@ -82,9 +82,6 @@ Setup (integrate in an existing django project)
8282
'django.contrib.sessions',
8383
'django.contrib.messages',
8484
'django.contrib.staticfiles',
85-
# admin
86-
'django_netjsonconfig.admin_theme',
87-
'django.contrib.admin',
8885
# all-auth
8986
'django.contrib.sites',
9087
'allauth',
@@ -95,6 +92,9 @@ Setup (integrate in an existing django project)
9592
'openwisp_users',
9693
'openwisp_controller.pki',
9794
'openwisp_controller.config',
95+
# admin
96+
'django_netjsonconfig.admin_theme',
97+
'django.contrib.admin',
9898
# other dependencies
9999
'sortedm2m',
100100
'reversion',

openwisp_controller/config/tests/test_admin.py

+21
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,27 @@ def test_preview_config(self):
9494
self.assertContains(response, 'eth0')
9595
self.assertContains(response, 'dhcp')
9696

97+
def test_config_preview_button(self):
98+
config = self._create_config(organization=self._create_org())
99+
path = reverse('admin:config_config_change', args=[config.pk])
100+
self._login()
101+
response = self.client.get(path)
102+
self.assertIn('Preview', str(response.content))
103+
104+
def test_template_preview_button(self):
105+
t = self._create_template(organization=self._create_org())
106+
path = reverse('admin:config_template_change', args=[t.pk])
107+
self._login()
108+
response = self.client.get(path)
109+
self.assertIn('Preview', str(response.content))
110+
111+
def test_vpn_preview_button(self):
112+
v = self._create_vpn(organization=self._create_org())
113+
path = reverse('admin:config_vpn_change', args=[v.pk])
114+
self._login()
115+
response = self.client.get(path)
116+
self.assertIn('Preview', str(response.content))
117+
97118
def _create_multitenancy_test_env(self, vpn=False):
98119
org1 = self._create_org(name='test1org')
99120
org2 = self._create_org(name='test2org')

tests/settings.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
'django.contrib.sessions',
2222
'django.contrib.messages',
2323
'django.contrib.staticfiles',
24-
# admin
25-
'django_netjsonconfig.admin_theme',
26-
'django.contrib.admin',
2724
# all-auth
2825
'django.contrib.sites',
2926
'allauth',
@@ -34,6 +31,9 @@
3431
'openwisp_users',
3532
'openwisp_controller.pki',
3633
'openwisp_controller.config',
34+
# admin
35+
'django_netjsonconfig.admin_theme',
36+
'django.contrib.admin',
3737
# other dependencies
3838
'sortedm2m',
3939
'reversion',

0 commit comments

Comments
 (0)