def test_rabbit_matchable_name(self, mocked_func1, mocked_func2):
        '''
        The return value of the function that creates the matchable name is being mocked.
        With this test we ensure that the function create_matchable_name is actually being used.
        '''
        mocked_func1.return_value = 'Fake Name'
        mocked_func2.return_value = mocked_func1.return_value

        rabbit([self.main_bibrec], verbose=True)

        first_pid = run_sql(
            "select personid from aidPERSONIDPAPERS where bibrec=%s",
            (self.main_bibrec, ))[0][0]

        second_marcxml_record = get_new_marc_for_test(
            'Rabbit Test Paper', author_name=self.heavily_modified_name)
        second_bibrec = get_bibrec_for_record(second_marcxml_record,
                                              opt_mode='insert')
        self.bibrecs_to_clean.append(second_bibrec)

        rabbit([second_bibrec], verbose=True)

        second_pid = run_sql(
            "select personid from aidPERSONIDPAPERS where bibrec=%s",
            (second_bibrec, ))[0][0]
        self.assertEquals(first_pid, second_pid)
 def setUp(self):
     super(MnamesFunctionsTest, self).setUp()
     main_marcxml_record = get_new_marc_for_test(
         'Rabbit Test Paper', author_name=self.author_name)
     self.main_bibrec = get_bibrec_for_record(main_marcxml_record,
                                              opt_mode='insert')
     self.bibrecs_to_clean = list()
     self.bibrecs_to_clean.append(self.main_bibrec)
 def setUp(self):
     self._pid = get_free_author_id()
     self._orcid = '1234-1234-1234-1234'
     add_orcid_id_to_author(self._pid, self._orcid)
     marc = get_new_marc_for_test('Orcid test paper',
                                  author_name='Author, SomeAuthor',
                                  identifiers=['ORCID:' + self._orcid])
     self._rec = get_bibrec_for_record(marc, opt_mode="insert")
     rabbit([self._rec])
     populate_partial_marc_caches([self._rec])
 def setUp(self):
     super(CoauthorsRabbitTestCase, self).setUp()
     self.main_marcxml_record = get_new_marc_for_test(
         'Rabbit Test Paper',
         author_name=self.author_name,
         co_authors_names=self.co_authors_names,
         identifiers=None)
     self.main_bibrec = get_bibrec_for_record(self.main_marcxml_record,
                                              opt_mode='insert')
     self.main_marcxml_record = add_001_field(self.main_marcxml_record,
                                              self.main_bibrec)
     self.bibrecs_to_clean = list()
     self.bibrecs_to_clean.append(self.main_bibrec)
 def setUp(self):
     super(AuthorRabbitTestCase, self).setUp()
     self.main_marcxml_record = get_new_marc_for_test(
         'Rabbit Test Paper',
         author_name=self.author_name,
         identifiers=[(
             self.ext_id,
             'i',
         )])
     self.main_bibrec = get_bibrec_for_record(self.main_marcxml_record,
                                              opt_mode='insert')
     self.main_marcxml_record = add_001_field(self.main_marcxml_record,
                                              self.main_bibrec)
     self.bibrecs_to_clean = [self.main_bibrec]
Пример #6
0
 def setUp(self):
     super(Marc100700CacheTestCase, self).setUp()
     marc_xml_record = get_new_marc_for_test(
         "Test",
         author_name=self.author_name,
         identifiers=None,
         co_authors_names=self.co_authors_names)
     self.bibrec_to_test = get_bibrec_for_record(marc_xml_record,
                                                 opt_mode='insert')
     self.bibrecs_to_clean = [self.bibrec_to_test]
     bibrefs = get_bibrefs_from_bibrecs([self.bibrec_to_test])
     for bibref in bibrefs:
         self.ref_table = bibref[1][0][0].split(":")[0]
         self.ref_value = bibref[1][0][0].split(":")[1]
     populate_partial_marc_caches([self.bibrec_to_test])