Beispiel #1
0
 def test_as_json(self):
     flow = Flow.create_from_dict(self.odk_dict)
     _json = flow.as_json(False)
     _flow = _json["flows"][0]
     self.assertEqual(_flow["action_sets"], [_set.as_json(False) for _set in flow.action_sets.all()])
     self.assertEqual(_flow["rule_sets"], [rule_set.as_json(False) for rule_set in flow.rule_sets.all()])
     self.assertEqual(_flow["entry"], unicode(flow.action_sets.order_by("created_on").first().uuid))
Beispiel #2
0
 def test_as_json(self):
     rule_test = Flow.create_from_dict(ODK_DICT).rule_sets.all()[0].rules.all()[0].test
     _json = rule_test.as_json(False)
     self.assertEqual(_json["type"], rule_test.type)
     self.assertEqual(_json["test"], rule_test.test)
Beispiel #3
0
 def setUp(self):
     self.input = ODK_DICT["html"]["head"]["model"]["bind"][0]
     self.rule_set = Flow.create_from_dict(ODK_DICT).rule_sets.all()[0]
Beispiel #4
0
 def setUp(self):
     self.input = ODK_DICT["html"]["head"]["model"]["bind"][0]
     self.flow = Flow.create_from_dict(ODK_DICT)
Beispiel #5
0
 def test_create_flow_from_dict(self):
     n = Flow.objects.count()
     flow = Flow.create_from_dict(self.odk_dict)
     self.assertEqual(Flow.objects.count(), n + 1)
     self.assertEqual(flow.name, self.odk_dict["html"]["head"]["title"])
Beispiel #6
0
 def test_as_json(self):
     action = Flow.create_from_dict(ODK_DICT).action_sets.all()[0].actions.all()[0]
     _json = action.as_json(False)
     self.assertEqual(_json["type"], action.type)
     self.assertEqual(_json["msg"], {"eng": action.msg})
Beispiel #7
0
 def setUp(self):
     self.input = ODK_DICT["html"]["body"]["input"][0]
     self.flow = Flow.create_from_dict(ODK_DICT)
Beispiel #8
0
def from_xform(xml_file):
    _dict = XFormToDict(xml_file)
    flow = Flow.create_from_dict(_dict)
    return flow.as_json()