Skip to content

Commit

Permalink
add test for multiple model nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ukanga committed Nov 15, 2024
1 parent 571414a commit 730db05
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions onadata/apps/logger/tests/models/test_xform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
test_xform module
"""

import os

from builtins import str as text
Expand Down Expand Up @@ -227,3 +228,26 @@ def test_id_string_length(self):

with self.assertRaises(XLSFormError):
xform.save()

def test_multiple_model_nodes(self):
"""
Test XForm.set_uuid_in_xml() function is able to handle
a form that has field named model which may match the XForm's
top level node also named model.
"""
md = """
| survey |
| | type | name | label |
| | select one fruits | fruit | Fruit |
| | text | model | Model |
| choices |
| | list name | name | label |
| | fruits | orange | Orange |
| | fruits | mango | Mango |
"""
dd = self._publish_markdown(md, self.user, id_string="a")
self.assertNotIn(
"<formhub>\n <uuid/>\n </formhub>\n", dd.xml
)
dd.set_uuid_in_xml()
self.assertIn("<formhub>\n <uuid/>\n </formhub>\n", dd.xml)

0 comments on commit 730db05

Please sign in to comment.