def test_duplicate_cc_marc21(self):
     # Default in test for Colorado College specific ingestor
     record = pymarc.Record()
     record.add_field(pymarc.Field(tag='907',
                                   indicators=[' ',' '],
                                   subfields=['a', '.b12345x']))
     TEST_REDIS.hset('ils-bib-numbers', 'b12345', 'bf:Work:1')
     ingester = MARC21toBIBFRAME(redis_datastore=TEST_REDIS,
                                 record=record)
     self.assert_(ingester.__duplicate_check__('ils-bib-numbers') is True)
 def test_duplicate_alliance_marc21(self):
     # Default in test record for the ingestor
     new_record = pymarc.Record()
     new_record.add_field(pymarc.Field(tag='945',
                                       indicators=[' ',' '],
                                       subfields=['a', 'test_a b12345']))
     TEST_REDIS.hset('ils-bib-numbers', 'b12345', 'bf:Work:1')
     ingester = MARC21toBIBFRAME(redis_datastore=TEST_REDIS,
                                 record=new_record)
     self.assert_(ingester.__duplicate_check__('ils-bib-numbers') is True)
 def test_extract_topics(self):
     wichita_indians_topic = models.Topic(redis_datastore=TEST_REDIS,
                                          label='Wichita Indians')
     wichita_indians_topic.save()
     TEST_REDIS.hset('lcsh-hash',
                     'http://id.loc.gov/authorities/subjects/sh85028785',
                     wichita_indians_topic.redis_key)
     ingester = JSONLinkedDataIngester(redis_datastore=TEST_REDIS)
     topics = [
         {'bf:identifier': 'http://id.loc.gov/authorities/subjects/sh85018617',
          'bf:label': u'Caddo Indians' },
         {'bf:identifier': 'http://id.loc.gov/authorities/subjects/sh85146582',
          'bf:label': u'Wichita Indians'},
         {'bf:identifier': 'http://id.loc.gov/authorities/subjects/sh85028785',
          'bf:label':  u'Comanche Indians'}]
     self.assertEquals(ingester.__extract_topics__(topics),
                       ['bf:Topic:2', 'bf:Topic:3', 'bf:Topic:1'])