Skip to content

Commit

Permalink
[change] Added case when action form is not rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Jun 20, 2024
1 parent cb7a7c0 commit 6d9c702
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions openwisp_utils/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,21 @@ def _test_action_permission(
# Verify action cannot be performed using forced request
response = self.client.post(path, data=payload, follow=True)
self.assertEqual(response.status_code, 200)
self.assertContains(
response,
'<ul class="messagelist">\n'
'<li class="warning">No action selected.</li>\n'
'</ul>',
html=True,
)
try:
self.assertContains(
response,
'<ul class="messagelist">\n'
'<li class="warning">No action selected.</li>\n'
'</ul>',
html=True,
)
except AssertionError:
# If there is only one admin action available for the user,
# and the user lacks permission for that action, then the
# admin action form will not be displayed on the changelist.
self.assertNotContains(
response, '<label>Action: <select name="action" required>'
)

# Add required permissions to the user
user.user_permissions.add(
Expand Down

0 comments on commit 6d9c702

Please sign in to comment.