mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fix tests to really hit admin actions
This commit is contained in:
parent
03e5279ec0
commit
c828da284c
@ -77,27 +77,41 @@ class PluginDetailAPITest(InvenTreeAPITestCase):
|
|||||||
print([str(a) for a in fixtures])
|
print([str(a) for a in fixtures])
|
||||||
fixtures = fixtures[0:1]
|
fixtures = fixtures[0:1]
|
||||||
# deactivate plugin
|
# deactivate plugin
|
||||||
self.post(url, {
|
response = self.client.post(url, {
|
||||||
'action': 'plugin_deactivate',
|
'action': 'plugin_deactivate',
|
||||||
'index': 0,
|
'index': 0,
|
||||||
'_selected_action': [f.pk for f in fixtures],
|
'_selected_action': [f.pk for f in fixtures],
|
||||||
}, expected_code=200)
|
}, follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# deactivate plugin - deactivate again -> nothing will hapen but the nothing 'changed' function is triggered
|
# deactivate plugin - deactivate again -> nothing will hapen but the nothing 'changed' function is triggered
|
||||||
self.post(url, {
|
response = self.client.post(url, {
|
||||||
'action': 'plugin_deactivate',
|
'action': 'plugin_deactivate',
|
||||||
'index': 0,
|
'index': 0,
|
||||||
'_selected_action': [f.pk for f in fixtures],
|
'_selected_action': [f.pk for f in fixtures],
|
||||||
}, expected_code=200)
|
}, follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# activate plugin
|
# activate plugin
|
||||||
self.post(url, {
|
response = self.client.post(url, {
|
||||||
'action': 'plugin_activate',
|
'action': 'plugin_activate',
|
||||||
'index': 0,
|
'index': 0,
|
||||||
'_selected_action': [f.pk for f in fixtures],
|
'_selected_action': [f.pk for f in fixtures],
|
||||||
}, expected_code=200)
|
}, follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# save to deactivate plugin
|
# activate everything
|
||||||
self.post(reverse('admin:plugin_pluginconfig_change', {'pk': fixtures[0].pk}), {
|
fixtures = PluginConfig.objects.all()
|
||||||
|
response = self.client.post(url, {
|
||||||
|
'action': 'plugin_activate',
|
||||||
|
'index': 0,
|
||||||
|
'_selected_action': [f.pk for f in fixtures],
|
||||||
|
}, follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
fixtures = PluginConfig.objects.filter(active=True)
|
||||||
|
# save to deactivate a plugin
|
||||||
|
response = self.client.post(reverse('admin:plugin_pluginconfig_change', args=(fixtures.first().pk, )), {
|
||||||
'_save': 'Save',
|
'_save': 'Save',
|
||||||
}, expected_code=200)
|
}, follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
Loading…
Reference in New Issue
Block a user