def test_new(self): dtd_url = 'http://xmltool.lereskp.fr/static/exercise.dtd' root_tag = 'choice' result = factory.new(dtd_url, root_tag) expected = ('<form method="POST" id="xmltool-form">' '<input type="hidden" name="_xml_filename" ' 'id="_xml_filename" value="" />' '<input type="hidden" name="_xml_dtd_url" ' 'id="_xml_dtd_url" ' 'value="http://xmltool.lereskp.fr/static/exercise.dtd" ' '/>' '<input type="hidden" name="_xml_encoding" ' 'id="_xml_encoding" value="UTF-8" />' '<a class="btn btn-add-ajax" data-id="choice">' 'Add choice</a>' '</form>') self.assertEqual(result, expected) result = factory.new(dtd_url, root_tag, '/submit') expected = ('<form action="/submit" method="POST" id="xmltool-form">' '<input type="hidden" name="_xml_filename" ' 'id="_xml_filename" value="" />' '<input type="hidden" name="_xml_dtd_url" ' 'id="_xml_dtd_url" ' 'value="http://xmltool.lereskp.fr/static/exercise.dtd" ' '/>' '<input type="hidden" name="_xml_encoding" ' 'id="_xml_encoding" value="UTF-8" />' '<a class="btn btn-add-ajax" data-id="choice">' 'Add choice</a>' '</form>') self.assertEqual(result, expected)
def test_new(self): dtd_url = 'tests/exercise.dtd' root_tag = 'choice' result = factory.new(dtd_url, root_tag) expected = ('<form method="POST" id="xmltool-form">' '<input type="hidden" name="_xml_filename" ' 'id="_xml_filename" value="" />' '<input type="hidden" name="_xml_dtd_url" ' 'id="_xml_dtd_url" ' 'value="tests/exercise.dtd" ' '/>' '<input type="hidden" name="_xml_encoding" ' 'id="_xml_encoding" value="UTF-8" />' '<a class="btn-add btn-add-choice" data-elt-id="choice">' 'Add choice</a>' '</form>') self.assertEqual(result, expected) result = factory.new(dtd_url, root_tag, '/submit') expected = ('<form method="POST" action="/submit" id="xmltool-form">' '<input type="hidden" name="_xml_filename" ' 'id="_xml_filename" value="" />' '<input type="hidden" name="_xml_dtd_url" ' 'id="_xml_dtd_url" ' 'value="tests/exercise.dtd" ' '/>' '<input type="hidden" name="_xml_encoding" ' 'id="_xml_encoding" value="UTF-8" />' '<a class="btn-add btn-add-choice" data-elt-id="choice">' 'Add choice</a>' '</form>') self.assertEqual(result, expected) result = factory.new(dtd_url, root_tag, '/submit', form_attrs={'data-action': 'action'}) expected = ('<form method="POST" action="/submit" ' 'data-action="action" id="xmltool-form">' '<input type="hidden" name="_xml_filename" ' 'id="_xml_filename" value="" />' '<input type="hidden" name="_xml_dtd_url" ' 'id="_xml_dtd_url" ' 'value="tests/exercise.dtd" ' '/>' '<input type="hidden" name="_xml_encoding" ' 'id="_xml_encoding" value="UTF-8" />' '<a class="btn-add btn-add-choice" data-elt-id="choice">' 'Add choice</a>' '</form>') self.assertEqual(result, expected)