예제 #1
0
파일: tests.py 프로젝트: SamGreen9/iip-2018
 def test_check_xml_wellformedness(self):
     """ Tests that xml is well-formed.
         TODO: eliminate this test and the code once there's a schema, and instead use validate_xml() """
     ## good
     xml = u"""<?xml version="1.0" encoding="utf-8"?><a><b></b></a>"""
     data_dict = common.check_xml_wellformedness(xml)
     self.assertEqual(True, data_dict[u'well_formed'])
     ## bad
     xml = u"""<a><b><b></a>"""
     data_dict = common.check_xml_wellformedness(xml)
     self.assertEqual(False, data_dict[u'well_formed'])
예제 #2
0
 def test_check_xml_wellformedness(self):
     """ Tests that xml is well-formed.
         TODO: eliminate this test and the code once there's a schema, and instead use validate_xml() """
     ## good
     xml = u"""<?xml version="1.0" encoding="utf-8"?><a><b></b></a>"""
     data_dict = common.check_xml_wellformedness( xml )
     self.assertEqual(
         True,
         data_dict[u'well_formed'] )
     ## bad
     xml = u"""<a><b><b></a>"""
     data_dict = common.check_xml_wellformedness( xml )
     self.assertEqual(
         False,
         data_dict[u'well_formed'] )
예제 #3
0
 def test_grab_original_xml( self ):
     """ Tests for well-formed xml and type of returned string.
         TODO: update to check for _valid_ xml once I have access to a schema. """
     p = Processor()
     grab_dict = p.grab_original_xml( file_id=u'beth0282' )
     ## type check
     self.assertEqual(
         unicode,
         type(grab_dict[u'xml']) )
     ## well-formedness check
     well_formedness_dict = common.check_xml_wellformedness( xml=grab_dict[u'xml'] )
     self.assertEqual(
         True,
         well_formedness_dict[u'well_formed'] )
예제 #4
0
 def test_make_initial_solr_doc( self ):
     """ Tests for well-formed xml and type of returned string.
         TODO: update to check for _valid_ xml once I have access to a schema. """
     p = Processor()
     grab_dict = p.grab_original_xml( file_id=u'beth0282' )
     munger_dict = p.run_munger( source_xml=grab_dict[u'xml'] )
     initial_doc_dict = p.make_initial_solr_doc( munger_dict[u'munged_xml'] )
     ## type check
     self.assertEqual(
         unicode,
         type(initial_doc_dict[u'transformed_xml']) )
     ## well-formedness check
     well_formedness_dict = common.check_xml_wellformedness( xml=initial_doc_dict[u'transformed_xml'] )
     self.assertEqual(
         True,
         well_formedness_dict[u'well_formed'] )
예제 #5
0
파일: tests.py 프로젝트: crotger/iip
 def test_make_initial_solr_doc( self ):
     """ Tests for well-formed xml and type of returned string.
         TODO: update to check for _valid_ xml once I have access to a schema.
         Note: if test fails, could be due to wireless ip changing, causing authNZ to fail. """
     p = Processor()
     grab_dict = p.grab_original_xml( file_id=u'beth0282' )
     log.debug( 'grab_dict, ```%s```' % pprint.pformat(grab_dict) )
     munger_dict = p.run_munger( source_xml=grab_dict[u'xml'] )
     initial_doc_dict = p.make_initial_solr_doc( munger_dict[u'munged_xml'] )
     ## type check
     self.assertEqual(
         unicode,
         type(initial_doc_dict[u'transformed_xml']) )
     ## well-formedness check
     well_formedness_dict = common.check_xml_wellformedness( xml=initial_doc_dict[u'transformed_xml'] )
     self.assertEqual(
         True,
         well_formedness_dict[u'well_formed'] )