def test_publish_invalid_xls_form_no_choices(self):
view = XFormViewSet.as_view({
'post': 'create'
})
path = os.path.join(
settings.PROJECT_ROOT, "apps", "main", "tests", "fixtures",
"transportation", "transportation.no_choices.xls")
with open(path) as xls_file:
post_data = {'xls_file': xls_file}
request = self.factory.post('/', data=post_data, **self.extra)
response = view(request)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.get('Last-Modified'), None)
error_msg = (
'There should be a choices sheet in this xlsform. Please '
'ensure that the choices sheet name is all in small caps.')
self.assertEqual(response.data.get('text'), error_msg)
评论列表
文章目录