def test_non_existent_plugin_submission(self):
"""
Test that a submitting a form for a non-existent plugin meets
defined behavior.
"""
sample_name = self.get_random_string(10)
sample_msg = self.get_random_string(100)
# Get non-existent plugin ID:
bad_id = CMSPlugin.objects.aggregate(max=Max('id'))['max'] + 1
assert bad_id
action_url = reverse(
'cmsplugin_form_handler:process_form',
args=(bad_id + 1, )
)
with self.assertRaises(ImproperlyConfigured):
self.client.post(action_url, {
'name': sample_name,
'message': sample_msg,
'cmsplugin_form_source_url': '/en/',
}, follow=True)
评论列表
文章目录