def test_create_api_request(self): zelfratz.conf = zelfratz.configuration(None, None, '666') target = "http://api.digital-tunes.net/releases/by_artist/pyro?key=666" result = zelfratz.create_api_request(zelfratz.ARTIST, self.pyro) self.assertEqual(target, result, msg="test_create_api_request failed with ARTIST") target = "http://api.digital-tunes.net/releases/by_label/digital_venom?key=666" result = zelfratz.create_api_request(zelfratz.LABEL, self.digital_venom) self.assertEqual(target, result, msg="test_create_api_request failed with LABEL")
def test_check_updates(self): # load an empty cache zelfratz.conf = zelfratz.configuration(None, zelfratz.zdata(), None) # this will invoke the OVERRIDE and add stuff in xml to cache zelfratz.check_updates_artists([self.pyro]) zelfratz.check_updates_labels([self.digital_venom]) # now comapare the cache to one thats on disk target = zelfratz.read_cache('test_cache') result = zelfratz.conf.cache self.assertEqual(target, result, msg="test_check_updates failed")
def test_difference(self): # load apparently old artist info into cache zelfratz.conf = zelfratz.configuration(None, zelfratz.zdata(), None) rel = load_xml_from_file('old_releases_by_artist.xml') zelfratz.conf.cache.update_artist(self.pyro, rel) # load apparently old label info into cache rel = load_xml_from_file('old_releases_by_label.xml') zelfratz.conf.cache.update_label(self.digital_venom, rel) # now run the update methods and see what the return result = zelfratz.check_updates_artists([self.pyro]) target = unpickle('pickled_artist_updates') self.assertEqual(target, result, msg="test_difference failed for artists") result = zelfratz.check_updates_labels([self.digital_venom]) target = unpickle('pickled_label_updates') self.assertEqual(target, result, msg="test_difference failed for labels")