Skip to content

Commit

Permalink
Merge pull request #1772 Upgrade PyXForm to v0.15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ukanga committed Feb 12, 2020
2 parents 556e970 + 707427f commit 6b39463
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion onadata/apps/api/tests/fixtures/Transportation Form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'motorbike')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'taxi')" type="select1"/>
<bind nodeset="/transportation/image1" type="binary"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
<bind jr:preload="uid" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="'%(form_uuid)s'" nodeset="/transportation/formhub/uuid" type="string"/>
</model>
</h:head>
Expand Down
2 changes: 1 addition & 1 deletion onadata/apps/api/tests/viewsets/test_floip_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_publish_number_question_names(self): # pylint: disable=C0103
self.assertEqual(response.status_code, 400)
self.assertEqual(response['Content-Type'],
'application/vnd.api+json')
self.assertIn(u"The name '1448506769745_42' is an invalid xml tag",
self.assertIn(u"The name '1448506769745_42' is an invalid XML tag",
response.data['text'])

def test_responses_endpoint_format(self):
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'motorbike')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'taxi')" type="select1"/>
<bind nodeset="/transportation/image1" type="binary"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
<bind jr:preload="uid" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="''" nodeset="/transportation/formhub/uuid" type="string"/>
</model>
</h:head>
Expand Down
28 changes: 25 additions & 3 deletions onadata/apps/main/tests/test_form_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,31 @@ def test_spaced_xlsform(self):
self.xform.save()
xls_path = os.path.join(self.this_directory, "fixtures",
"transportation", "tutorial .xls")
msg = u"The name 'tutorial ' is an invalid xml tag. Names must begin"\
u" with a letter, colon, or underscore, subsequent characters "\
u"can include numbers, dashes, and periods"
msg = ("The name 'tutorial ' is an invalid XML tag, it contains an"
" invalid character ' '. Names must begin with a letter, colon,"
" or underscore, subsequent characters can include numbers, "
"dashes, and periods")
self.assertRaisesMessage(
PyXFormError, msg, self._publish_xls_file, xls_path)
self.assertEquals(XForm.objects.count(), count)

def test_choice_duplicate_error(self):
"""
Test that the choice duplicate error is raised if
the "allow_choice_duplicates" setting is not set in the
forms settings sheet
"""
count = XForm.objects.count()
xls_path = os.path.join(
self.this_directory, 'fixtures', 'cascading_selects',
'duplicate_choice_form.xls')
msg = ("There does not seem to be"
" a `allow_choice_duplicates`"
" column header defined in your settings sheet."
" You must have set `allow_choice_duplicates`"
" setting in your settings sheet"
" to have duplicate choice list names"
" in your choices sheet")
self.assertRaisesMessage(
PyXFormError, msg, self._publish_xls_file, xls_path)
self.assertEquals(XForm.objects.count(), count)
2 changes: 1 addition & 1 deletion onadata/apps/main/tests/test_past_bugs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class TestCascading(TestBase):

def test_correct_id_string_picked(self):
XForm.objects.all().delete()
name = 'new_cascading_select.xls'
name = 'new_cascading_select.xlsx'
id_string = u'cascading_select_test'
self._publish_xls_file(os.path.join(
self.this_directory, 'fixtures', 'bug_fixes', name))
Expand Down
2 changes: 1 addition & 1 deletion onadata/apps/main/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def test_uuid_injection_in_cascading_select(self):
pre_count = XForm.objects.count()
xls_path = os.path.join(
self.this_directory, "fixtures", "cascading_selects",
"new_cascading_select.xls")
"new_cascading_select.xlsx")
file_name, file_ext = os.path.splitext(os.path.split(xls_path)[1])
TestBase._publish_xls_file(self, xls_path)
post_count = XForm.objects.count()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_get_merged_xform_survey(self):
u'name': u'instanceID',
u'bind': {
u'readonly': u'true()',
u'calculate': u"concat('uuid:', uuid())"
u'jr:preload': u"uid"
},
u'type': u'calculate'
}],
Expand Down Expand Up @@ -314,7 +314,7 @@ def test_group_merged_xform_survey(self):
u'name': u'instanceID',
u'bind': {
u'readonly': u'true()',
u'calculate': u"concat('uuid:', uuid())"
u'jr:preload': u"uid"
},
u'type': u'calculate'
}],
Expand Down Expand Up @@ -391,7 +391,7 @@ def test_repeat_merged_xform_survey(self):
u'name': u'instanceID',
u'bind': {
u'readonly': u'true()',
u'calculate': u"concat('uuid:', uuid())"
u'jr:preload': u'uid'
},
u'type': u'calculate'
}],
Expand Down Expand Up @@ -431,7 +431,7 @@ def test_matching_fields_by_type(self):
u'name': u'instanceID',
u'bind': {
u'readonly': u'true()',
u'calculate': u"concat('uuid:', uuid())"
u'jr:preload': u'uid'
},
u'type': u'calculate'
}],
Expand Down
6 changes: 5 additions & 1 deletion onadata/libs/tests/utils/test_export_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,10 @@ def test_zipped_sav_export_with_duplicate_name_in_choice_list(self):
| | animals | 6 | Other | # <--- duplicate name
| | animals | 8 | None |
| | animals | 9 | Don't Know |
| settings | |
| | allow_choice_duplicates |
| | Yes |
"""
survey = self.md_to_pyxform_survey(md, {'name': 'exp'})
data = [{"q1": "1",
Expand Down Expand Up @@ -2185,7 +2189,7 @@ def test_select_multiples_choices(self):

def test_select_multiples_choices_with_choice_filter(self):
survey = create_survey_from_xls(_logger_fixture_path(
'choice_filter.xls'
'choice_filter.xlsx'
))
dd = DataDictionary()
dd._survey = survey
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.pip
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pyrsistent==0.15.1 # via jsonschema
python-dateutil==2.8.0 # via fleming, tableschema
python-memcached==1.59
pytz==2019.1 # via babel, celery, django, django-query-builder, fleming
pyxform==0.13.1
pyxform==0.15.1
raven==6.10.0
recaptcha-client==1.0.6
requests-mock==1.6.0
Expand Down

0 comments on commit 6b39463

Please sign in to comment.