コード例 #1
0
 def test_to_xml_multi_form(self):
     data = dict(self.make_mgmt_data(2).items() + self.make_sub_form_data(0).items() + self.make_sub_form_data(1).items())
     form = Form(self.uih, data, prefix=self.prefix)
     self.assertTrue(form.is_valid())
     root = create_root('root')
     form.to_xml(root)
     self.assertTrue(css('skymaker[id="6"]')(root))
     self.assertTrue(css('skymaker module-version')(root))
     self.assertTrue(css('skymaker module-version')(root))
     self.assertTrue(css('skymaker parents item')(root))
     self.assertEqual(len(css('skymaker images item')(root)), 2)
コード例 #2
0
 def test_from_xml_multi_form(self):
     data = dict(self.make_mgmt_data(2).items() + self.make_sub_form_data(0).items() + self.make_sub_form_data(1).items())
     form = Form(self.uih, data, prefix=self.prefix)
     self.assertTrue(form.is_valid())
     root = create_root('tao', xmlns='http://tao.asvo.org.au/schema/module-parameters-v1')
     work = child_element(root, 'workflow')
     child_element(work, 'schema-version', '2.0')
     form.to_xml(work)
     root = xml_parse(xml_print(root)) ## do this to recover namespace info not explicit above
     form = Form.from_xml(self.uih, root, self.prefix)
     self.assertTrue(form.is_valid())
     self.assertEqual(form.total_form_count(), 2, msg='Must create extra form.')
コード例 #3
0
def _make_parameters(user, forms):
    # precondition: forms are valid

    root = create_root('tao', timestamp=time.timestamp(), nsmap={None:NAMESPACE})

    child_element(root, 'username', text=user.username)

    workflow = find_or_create(root, 'workflow', name='alpha-light-cone-image')
    child_element(workflow, 'schema-version', text='2.0')

    for form in forms:
        form.to_xml(workflow)

    child_element(root, 'signature', text='base64encodedsignature')

    return xml_print(root)