Skip to content

Commit

Permalink
[test] Fixed failing tests due to openwisp-utils menu changes
Browse files Browse the repository at this point in the history
Co-authored-by: Pedro Peña <pedro@makedit.com>
  • Loading branch information
pniaps and Pedro Peña committed Aug 24, 2021
1 parent a44e2fd commit 2a64e09
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions openwisp_controller/config/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,16 +1259,16 @@ def test_admin_menu_groups(self):
self.client.force_login(self._get_admin())
response = self.client.get(reverse('admin:index'))
for model in models:
with self.subTest(f'test_menu_group_for_{model}_model'):
with self.subTest(f'test menu group link for {model} model'):
url = reverse(f'admin:{self.app_label}_{model}_changelist')
self.assertContains(response, f'<a class="mg-link" href="{url}">')
with self.subTest('test_configuration_group_is_registered'):
self.assertContains(response, f' class="mg-link" href="{url}"')
with self.subTest('test "Configurations" group is registered'):
self.assertContains(
response,
'<div class="mg-dropdown-label">Configurations </div>',
html=True,
)
# Test Device is registered as menu item
with self.subTest('test_device_is_registered_as_menu_item'):
with self.subTest('test device menu item is registered'):
url = reverse(f'admin:{self.app_label}_device_changelist')
self.assertContains(response, f'<a class="menu-item" href="{url}">')
self.assertContains(response, f' class="menu-item" href="{url}"')
4 changes: 2 additions & 2 deletions openwisp_controller/connection/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def test_admin_menu_groups(self):
models = ['credentials']
response = self.client.get(reverse('admin:index'))
for model in models:
with self.subTest(f'test_menu_group_for_{model}_model'):
with self.subTest(f'test menu group link for {model} model'):
url = reverse(f'admin:{self.app_label}_{model}_changelist')
self.assertContains(response, f'<a class="mg-link" href="{url}">')
self.assertContains(response, f' class="mg-link" href="{url}"')


class TestCommandInlines(TestAdminMixin, CreateConnectionsMixin, TestCase):
Expand Down
6 changes: 3 additions & 3 deletions openwisp_controller/geo/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ def test_admin_menu_groups(self):
models = ['location', 'floorplan']
response = self.client.get(reverse('admin:index'))
for model in models:
with self.subTest(f'test_admin_group_for_{model}_model'):
with self.subTest(f'test menu group link for {model} model'):
url = reverse(f'admin:{self.app_label}_{model}_changelist')
self.assertContains(response, f'<a class="mg-link" href="{url}">')
with self.subTest('test_geo_group_is_registered'):
self.assertContains(response, f' class="mg-link" href="{url}"')
with self.subTest('test "Geographic Info" group is registered'):
self.assertContains(
response,
'<div class="mg-dropdown-label">Geographic Info </div>',
Expand Down
6 changes: 3 additions & 3 deletions openwisp_controller/pki/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def test_admin_menu_groups(self):
models = ['ca', 'cert']
response = self.client.get(reverse('admin:index'))
for model in models:
with self.subTest(f'test_admin_group_for_{model}_model'):
with self.subTest(f'test menu group link for {model} model'):
url = reverse(f'admin:{self.app_label}_{model}_changelist')
self.assertContains(response, f'<a class="mg-link" href="{url}">')
with self.subTest('test_configuration_group_is_registered'):
self.assertContains(response, f' class="mg-link" href="{url}"')
with self.subTest('test "Cas & Certificates" group is registered'):
self.assertContains(
response,
'<div class="mg-dropdown-label">Cas & Certificates </div>',
Expand Down

0 comments on commit 2a64e09

Please sign in to comment.