def _run_solr_steps( self, initial_id ): """ Takes initial_id string. Runs through processing steps including running update_solr(). Returns update_solr_dict. Called by test_update_solr(). """ p = Processor() grab_dict = p.grab_original_xml( file_id=initial_id ) munger_dict = p.run_munger( source_xml=grab_dict[u'xml'] ) initial_doc_dict = p.make_initial_solr_doc( munger_dict[u'munged_xml'] ) updated_disply_dict = p.update_display_facet( initial_solr_xml=initial_doc_dict[u'transformed_xml'], display_status=u'to_approve' ) update_solr_dict = p.update_solr( updated_disply_dict[u'updated_xml'] ) return update_solr_dict
def test_run_munger( 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'] ) ## type check self.assertEqual( unicode, type(munger_dict[u'munged_xml']) ) ## well-formedness check well_formedness_dict = common.check_xml_wellformedness( xml=munger_dict[u'munged_xml'] ) self.assertEqual( True, well_formedness_dict[u'well_formed'] )
def test_update_display_facet( 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'] ) updated_disply_dict = p.update_display_facet( initial_solr_xml=initial_doc_dict[u'transformed_xml'], display_status=u'to_approve' ) ## type check self.assertEqual( unicode, type(updated_disply_dict[u'updated_xml']) ) ## well-formedness check well_formedness_dict = common.check_xml_wellformedness( xml=updated_disply_dict[u'updated_xml'] ) self.assertEqual( True, well_formedness_dict[u'well_formed'] )
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'] )