def test_invalid_form_submission_no_session(self):
"""
Test that the desired response occurs when the form is not valid, when
there is no session.
"""
# First get the number Sample-instances
current_samples = Sample.objects.count()
sample_name = ''
sample_msg = self.get_random_string(100)
action_url = reverse(
'cmsplugin_form_handler:process_form',
args=(self.model_form_plugin.pk, )
)
response = self.client.post(action_url, {
'name': sample_name,
'message': sample_msg,
'cmsplugin_form_source_url': '/en/',
}, follow=True)
self.assertEqual(response.status_code, 200)
# Ensure we didn't add any new samples
assert Sample.objects.count() == current_samples
评论列表
文章目录