Skip to content

Commit

Permalink
Update tests to use 'data' as the default xml root node
Browse files Browse the repository at this point in the history
As of PyXForm v1.0.0 the name of the file is no longer used as the root
node. More Info: XLSForm/pyxform#375
  • Loading branch information
DavisRayM committed Mar 13, 2020
1 parent 52a3882 commit 8eadfb1
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 138 deletions.
80 changes: 40 additions & 40 deletions onadata/apps/api/tests/fixtures/Transportation Form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>transportation_2011_07_25</h:title>
<model>
<model odk:xforms-version="1.0.0">
<instance>
<transportation id="transportation_2011_07_25" version="20141112071722">
<data id="transportation_2011_07_25" version="20141112071722">
<formhub>
<uuid/>
</formhub>
Expand Down Expand Up @@ -45,28 +45,28 @@
<meta>
<instanceID/>
</meta>
</transportation>
</data>
</instance>
<bind nodeset="/transportation/transport/available_transportation_types_to_referral_facility" type="select"/>
<bind nodeset="/transportation/transport/available_transportation_types_to_referral_facility_other" relevant="selected(../available_transportation_types_to_referral_facility, 'other')" type="string"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/ambulance/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'ambulance')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/bicycle/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'bicycle')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/boat_canoe/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'boat_canoe')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/bus/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'bus')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/donkey_mule_cart/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'donkey_mule_cart')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/keke_pepe/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'keke_pepe')" type="select1"/>
<bind nodeset="/transportation/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility" relevant="selected( /transportation/transport/available_transportation_types_to_referral_facility , 'lorry')" type="select1"/>
<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 jr:preload="uid" nodeset="/transportation/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="'%(form_uuid)s'" nodeset="/transportation/formhub/uuid" type="string"/>
<bind nodeset="/data/transport/available_transportation_types_to_referral_facility" type="string"/>
<bind nodeset="/data/transport/available_transportation_types_to_referral_facility_other" relevant="selected(../available_transportation_types_to_referral_facility, 'other')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/ambulance/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'ambulance')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/bicycle/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'bicycle')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/boat_canoe/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'boat_canoe')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/bus/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'bus')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/donkey_mule_cart/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'donkey_mule_cart')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/keke_pepe/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'keke_pepe')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'lorry')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'motorbike')" type="string"/>
<bind nodeset="/data/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility" relevant="selected( /data/transport/available_transportation_types_to_referral_facility , 'taxi')" type="string"/>
<bind nodeset="/data/image1" type="binary"/>
<bind jr:preload="uid" nodeset="/data/meta/instanceID" readonly="true()" type="string"/>
<bind calculate="'%(form_uuid)s'" nodeset="/data/formhub/uuid" type="string"/>
</model>
</h:head>
<h:body>
<group ref="/transportation/transport">
<group ref="/data/transport">
<label>Transportation</label>
<select ref="/transportation/transport/available_transportation_types_to_referral_facility">
<select ref="/data/transport/available_transportation_types_to_referral_facility">
<label>What types of transportation are available from here to the referral health facility?</label>
<item>
<label>ambulance</label>
Expand Down Expand Up @@ -109,13 +109,13 @@
<value>other</value>
</item>
</select>
<input ref="/transportation/transport/available_transportation_types_to_referral_facility_other">
<input ref="/data/transport/available_transportation_types_to_referral_facility_other">
<label>Specify other.</label>
</input>
<group ref="/transportation/transport/loop_over_transport_types_frequency">
<group ref="/transportation/transport/loop_over_transport_types_frequency/ambulance">
<group ref="/data/transport/loop_over_transport_types_frequency">
<group ref="/data/transport/loop_over_transport_types_frequency/ambulance">
<label>ambulance</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/ambulance/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/ambulance/frequency_to_referral_facility">
<label>Is ambulance available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -135,9 +135,9 @@
</item>
</select1>
</group>
<group ref="/transportation/transport/loop_over_transport_types_frequency/bicycle">
<group ref="/data/transport/loop_over_transport_types_frequency/bicycle">
<label>bicycle</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/bicycle/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/bicycle/frequency_to_referral_facility">
<label>Is bicycle available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -157,9 +157,9 @@
</item>
</select1>
</group>
<group ref="/transportation/transport/loop_over_transport_types_frequency/boat_canoe">
<group ref="/data/transport/loop_over_transport_types_frequency/boat_canoe">
<label>boat/canoe</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/boat_canoe/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/boat_canoe/frequency_to_referral_facility">
<label>Is boat/canoe available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -179,9 +179,9 @@
</item>
</select1>
</group>
<group ref="/transportation/transport/loop_over_transport_types_frequency/bus">
<group ref="/data/transport/loop_over_transport_types_frequency/bus">
<label>bus</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/bus/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/bus/frequency_to_referral_facility">
<label>Is bus available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -201,9 +201,9 @@
</item>
</select1>
</group>
<group ref="/transportation/transport/loop_over_transport_types_frequency/donkey_mule_cart">
<group ref="/data/transport/loop_over_transport_types_frequency/donkey_mule_cart">
<label>donkey/mule/cart</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/donkey_mule_cart/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/donkey_mule_cart/frequency_to_referral_facility">
<label>Is donkey/mule/cart available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -223,9 +223,9 @@
</item>
</select1>
</group>
<group ref="/transportation/transport/loop_over_transport_types_frequency/keke_pepe">
<group ref="/data/transport/loop_over_transport_types_frequency/keke_pepe">
<label>keke napep</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/keke_pepe/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/keke_pepe/frequency_to_referral_facility">
<label>Is keke napep available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -245,9 +245,9 @@
</item>
</select1>
</group>
<group ref="/transportation/transport/loop_over_transport_types_frequency/lorry">
<group ref="/data/transport/loop_over_transport_types_frequency/lorry">
<label>lorry</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/lorry/frequency_to_referral_facility">
<label>Is lorry available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -267,9 +267,9 @@
</item>
</select1>
</group>
<group ref="/transportation/transport/loop_over_transport_types_frequency/motorbike">
<group ref="/data/transport/loop_over_transport_types_frequency/motorbike">
<label>motorbike</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/motorbike/frequency_to_referral_facility">
<label>Is motorbike available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -289,9 +289,9 @@
</item>
</select1>
</group>
<group ref="/transportation/transport/loop_over_transport_types_frequency/taxi">
<group ref="/data/transport/loop_over_transport_types_frequency/taxi">
<label>taxi</label>
<select1 ref="/transportation/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility">
<select1 ref="/data/transport/loop_over_transport_types_frequency/taxi/frequency_to_referral_facility">
<label>Is taxi available daily or weekly?</label>
<item>
<label>Daily</label>
Expand All @@ -313,7 +313,7 @@
</group>
</group>
</group>
<upload mediatype="image/*" ref="/transportation/image1">
<upload mediatype="image/*" ref="/data/image1">
<label>Photo</label>
</upload>
</h:body>
Expand Down
2 changes: 1 addition & 1 deletion onadata/apps/api/tests/viewsets/test_dataview_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_get_dataview_form_definition(self):
self._create_dataview()

data = {
"name": "tutorial",
"name": "data",
"title": "tutorial",
"default_language": "default",
"id_string": "tutorial",
Expand Down
10 changes: 5 additions & 5 deletions onadata/apps/api/tests/viewsets/test_xform_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def test_form_format(self):
})
formid = self.xform.pk
data = {
"name": "transportation",
"name": "data",
"title": "transportation_2011_07_25",
"default_language": "default",
"id_string": "transportation_2011_07_25",
Expand Down Expand Up @@ -634,7 +634,7 @@ def test_form_format(self):
uuid_nodes = [
node for node in model_node.childNodes
if node.nodeType == Node.ELEMENT_NODE and
node.getAttribute("nodeset") == "/transportation/formhub/uuid"]
node.getAttribute("nodeset") == "/data/formhub/uuid"]
self.assertEqual(len(uuid_nodes), 1)
uuid_node = uuid_nodes[0]
uuid_node.setAttribute("calculate", "''")
Expand Down Expand Up @@ -2200,7 +2200,7 @@ def test_manager_can_update_xform_xls_file(self):
fhuuid = xml.find('formhub/uuid')
self.assertEqual(
xml[xml[:fhuuid].rfind('=') + 2:fhuuid],
'/transportation/'
'/data/'
)

view = XFormViewSet.as_view({
Expand Down Expand Up @@ -2237,7 +2237,7 @@ def test_manager_can_update_xform_xls_file(self):
fhuuid = xml.find('formhub/uuid')
self.assertEqual(
xml[xml[:fhuuid].rfind('=') + 2:fhuuid],
'/transportation/'
'/data/'
)

def test_update_xform_with_different_id_string_form_with_sub(self):
Expand Down Expand Up @@ -2346,7 +2346,7 @@ def test_update_xform_xls_file_with_different_model_name(self):
response = view(request, pk=form_id)
self.assertEqual(response.status_code, 200)
xform = XForm.objects.get(pk=form_id)
self.assertEqual('transportation',
self.assertEqual('data',
xform.survey.xml_instance().tagName)

def test_id_strings_should_be_unique_in_each_account(self):
Expand Down
Loading

0 comments on commit 8eadfb1

Please sign in to comment.