def test_3(self): config.setting = settings.copy() rlist = self.load_data('release_group_4.json') r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '5 / 2009 / FR / CD / label A / cat 123 / 0123456789') self.assertEqual(r.versions[1]['name'], '5 / 2009 / FR / CD / label A / cat 123 / [no barcode]')
def test_2(self): self.set_config_values(settings) rlist = load_test_json('release_group_3.json') r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '5 / 2011 / FR / CD / label A / cat 123 / special A') self.assertEqual(r.versions[1]['name'], '5 / 2011 / FR / CD / label A / cat 123')
def test_2(self): config.setting = settings rlist = self.load_data('release_group_3.json') r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '5 / 2011 / FR / CD / label A / cat 123 / special A') self.assertEqual(r.versions[1]['name'], '5 / 2011 / FR / CD / label A / cat 123')
def test_2(self): config.setting = settings.copy() rlist = self.load_data('release_group_3.json') r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '5 / 2011 / FR / CD / label A / cat 123 / special A') self.assertEqual(r.versions[1]['name'], '5 / 2011 / FR / CD / label A / cat 123')
def test_3(self): self.set_config_values(settings) rlist = load_test_json('release_group_4.json') r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual( r.versions[0]['name'], '5 / 2009 / FR / CD / label A / cat 123 / 0123456789') self.assertEqual( r.versions[1]['name'], '5 / 2009 / FR / CD / label A / cat 123 / [no barcode]')
def test_1(self): config.setting = settings.copy() rlist = self.load_data('release_group_2.json') r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Jewel Case / special') self.assertEqual(r.versions[1]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Digipak / special') self.assertEqual(r.versions[2]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Digipak / specialx')
def test_1(self): self.set_config_values(settings) rlist = load_test_json('release_group_2.json') r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual( r.versions[0]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Jewel Case / special') self.assertEqual( r.versions[1]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Digipak / special') self.assertEqual( r.versions[2]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Digipak / specialx')
def test_release_group(self): m = Metadata() r = ReleaseGroup("1") release_group_to_metadata(self.json_doc, m, r) self.assertEqual(m['musicbrainz_releasegroupid'], 'f5093c06-23e3-404f-aeaa-40f72885ee3a') self.assertEqual(m['originaldate'], '1973-03-24') self.assertEqual(m['originalyear'], '1973') self.assertEqual(m['releasetype'], 'album') self.assertEqual(m['~primaryreleasetype'], 'album') self.assertEqual(m['~releasegroup'], 'The Dark Side of the Moon') self.assertEqual(r.genres, {'test2': 3, 'test': 6})
def get_release_group_by_id(self, rg_id): return self.release_groups.setdefault(rg_id, ReleaseGroup(rg_id))
def test_1(self): config.setting = settings rlist = XmlNode(children={ 'metadata': [XmlNode(children={ 'release_list': [XmlNode(attribs={'count': '3'}, children={ 'release': [ XmlNode(attribs={'id': '123'}, children={ 'title': [XmlNode(text='Foo')], 'status': [XmlNode(text='Official')], 'packaging': [XmlNode(text='Jewel Case')], 'disambiguation': [XmlNode(text='special')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2009-08-07')], 'country': [XmlNode(text='GB')], 'barcode': [XmlNode(text='012345678929')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), XmlNode(attribs={'id': '456'}, children={ 'title': [XmlNode(text='Foo')], 'status': [XmlNode(text='Official')], 'packaging': [XmlNode(text='Digipak')], 'disambiguation': [XmlNode(text='special')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2009-08-07')], 'country': [XmlNode(text='GB')], 'barcode': [XmlNode(text='012345678929')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), XmlNode(attribs={'id': '789'}, children={ 'title': [XmlNode(text='Foo')], 'status': [XmlNode(text='Official')], 'packaging': [XmlNode(text='Digipak')], 'disambiguation': [XmlNode(text='specialx')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2009-08-07')], 'country': [XmlNode(text='GB')], 'barcode': [XmlNode(text='012345678929')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), ] })] })] }) r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '2009-08-07 / GB / label A / cat 123 / 5 / CD / Jewel Case / special') self.assertEqual(r.versions[1]['name'], '2009-08-07 / GB / label A / cat 123 / 5 / CD / Digipak / special') self.assertEqual(r.versions[2]['name'], '2009-08-07 / GB / label A / cat 123 / 5 / CD / Digipak / specialx')
def test_2(self): config.setting = settings rlist = XmlNode(children={ 'metadata': [XmlNode(children={ 'release_list': [XmlNode(attribs={'count': '2'}, children={ 'release': [ XmlNode(attribs={'id': '789'}, children={ 'title': [XmlNode(text='Foox')], 'status': [XmlNode(text='Official')], 'disambiguation': [XmlNode(text='special A')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2011-08-07')], 'country': [XmlNode(text='FR')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), XmlNode(attribs={'id': '789'}, children={ 'title': [XmlNode(text='Foox')], 'status': [XmlNode(text='Official')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2011-08-07')], 'country': [XmlNode(text='FR')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), ] })] })] }) r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '2011-08-07 / FR / label A / cat 123 / 5 / CD / special A') self.assertEqual(r.versions[1]['name'], '2011-08-07 / FR / label A / cat 123 / 5 / CD')
def test_release_group(self): m = Metadata() r = ReleaseGroup("1") release_group_to_metadata(self.json_doc, m, r) self.assertEqual(m, {})
def get_release_group_by_id(self, rg_id): # pylint: disable=no-self-use return ReleaseGroup(rg_id)
def test_2(self): config.setting = settings rlist = XmlNode(children={ 'metadata': [XmlNode(children={ 'release_list': [XmlNode(attribs={'count': '2'}, children={ 'release': [ XmlNode(attribs={'id': '789'}, children={ 'title': [XmlNode(text='Foox')], 'status': [XmlNode(text='Official')], 'disambiguation': [XmlNode(text='special A')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2011-08-07')], 'country': [XmlNode(text='FR')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), XmlNode(attribs={'id': '789'}, children={ 'title': [XmlNode(text='Foox')], 'status': [XmlNode(text='Official')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2011-08-07')], 'country': [XmlNode(text='FR')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), ] })] })] }) r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '5 / 2011 / FR / CD / label A / cat 123 / special A') self.assertEqual(r.versions[1]['name'], '5 / 2011 / FR / CD / label A / cat 123')
def test_1(self): config.setting = settings rlist = XmlNode(children={ 'metadata': [XmlNode(children={ 'release_list': [XmlNode(attribs={'count': '3'}, children={ 'release': [ XmlNode(attribs={'id': '123'}, children={ 'title': [XmlNode(text='Foo')], 'status': [XmlNode(text='Official')], 'packaging': [XmlNode(text='Jewel Case')], 'disambiguation': [XmlNode(text='special')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2009-08-07')], 'country': [XmlNode(text='GB')], 'barcode': [XmlNode(text='012345678929')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), XmlNode(attribs={'id': '456'}, children={ 'title': [XmlNode(text='Foo')], 'status': [XmlNode(text='Official')], 'packaging': [XmlNode(text='Digipak')], 'disambiguation': [XmlNode(text='special')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2009-08-07')], 'country': [XmlNode(text='GB')], 'barcode': [XmlNode(text='012345678929')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), XmlNode(attribs={'id': '789'}, children={ 'title': [XmlNode(text='Foo')], 'status': [XmlNode(text='Official')], 'packaging': [XmlNode(text='Digipak')], 'disambiguation': [XmlNode(text='specialx')], 'text_representation': [XmlNode(children={ 'language': [XmlNode(text='eng')], 'script': [XmlNode(text='Latn')] })], 'date': [XmlNode(text='2009-08-07')], 'country': [XmlNode(text='GB')], 'barcode': [XmlNode(text='012345678929')], 'medium_list': [XmlNode(attribs={'count': '1'}, children={ 'medium': [XmlNode(children={ 'position': [XmlNode(text='1')], 'format': [XmlNode(text='CD')], 'track_list': [XmlNode(attribs={'count': '5'})], })] })], 'label_info_list': [XmlNode(attribs={'count': '1'}, children={ 'label_info': [XmlNode(children={ 'catalog_number': [XmlNode(text='cat 123')], 'label': [XmlNode(children={ 'name': [XmlNode(text='label A')] })] })] })] }), ] })] })] }) r = ReleaseGroup(1) r._parse_versions(rlist) self.assertEqual(r.versions[0]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Jewel Case / special') self.assertEqual(r.versions[1]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Digipak / special') self.assertEqual(r.versions[2]['name'], '5 / 2009 / GB / CD / label A / cat 123 / Digipak / specialx')