Stub requests here cause seach result order changes frequently. #18
This commit is contained in:
parent
687ce1b785
commit
87527daf9b
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
|
||||
<release-group type="Album" id="6f33e0f0-cde2-38f9-9aee-2c60af8d1a61">
|
||||
<title>Empire</title>
|
||||
<first-release-date>2006-08-28</first-release-date>
|
||||
<primary-type>Album</primary-type>
|
||||
<relation-list target-type="url">
|
||||
<relation type-id="6578f0e9-1ace-4095-9de8-6e517ddb1ceb" type="wikipedia">
|
||||
<target id="e831302f-4fa8-4630-afa5-4e32a795322a">http://en.wikipedia.org/wiki/Empire_(Kasabian_album)</target>
|
||||
</relation>
|
||||
<relation type-id="156344d3-da8b-40c6-8b10-7b1c22727124" type="lyrics">
|
||||
<target id="87d521d9-c78e-42fd-ac5e-98c82e6394a0">http://lyrics.wikia.com/Kasabian:Empire_(2006)</target>
|
||||
</relation>
|
||||
<relation type-id="c3ac9c3b-f546-4d15-873f-b294d2c1b708" type="review">
|
||||
<target id="732310f9-ac35-468f-b293-891c6f7d0812">http://www.bbc.co.uk/music/reviews/389x</target>
|
||||
</relation>
|
||||
<relation type-id="99e550f3-5ab4-3110-b5b9-fe01d970b126" type="discogs">
|
||||
<target id="1afddd13-53dd-4d0c-87e2-faf016725e95">http://www.discogs.com/master/89980</target>
|
||||
</relation>
|
||||
</relation-list>
|
||||
</release-group>
|
||||
</metadata>
|
|
@ -0,0 +1,79 @@
|
|||
<?xml version="1.0" standalone="yes"?>
|
||||
<metadata created="2013-05-06T14:05:42.527Z" xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0">
|
||||
<release-group-list count="2" offset="0">
|
||||
<release-group id="6f33e0f0-cde2-38f9-9aee-2c60af8d1a61" type="Album" ext:score="100">
|
||||
<title>Empire</title>
|
||||
<primary-type>Album</primary-type>
|
||||
<artist-credit>
|
||||
<name-credit>
|
||||
<artist id="69b39eab-6577-46a4-a9f5-817839092033">
|
||||
<name>Kasabian</name>
|
||||
<sort-name>Kasabian</sort-name>
|
||||
</artist>
|
||||
</name-credit>
|
||||
</artist-credit>
|
||||
<release-list count="7">
|
||||
<release id="9f068ed6-9f69-4a60-bf5a-0931176a9aba">
|
||||
<title>Empire</title>
|
||||
<status>Official</status>
|
||||
</release>
|
||||
<release id="30d5e730-ce0a-464d-93e1-7d76e4bb3e31">
|
||||
<title>Empire</title>
|
||||
<status>Official</status>
|
||||
</release>
|
||||
<release id="36ee86ab-0450-4d8f-a970-183c11f210c1">
|
||||
<title>Empire</title>
|
||||
<status>Official</status>
|
||||
</release>
|
||||
<release id="2225dd4c-ae9a-403b-8ea0-9e05014c778f">
|
||||
<title>Empire</title>
|
||||
<status>Official</status>
|
||||
</release>
|
||||
<release id="2c8dcfc6-4afe-4b33-abc7-dff1bb4c5386">
|
||||
<title>Empire</title>
|
||||
<status>Official</status>
|
||||
</release>
|
||||
<release id="2bc94ddc-b872-3b7f-b0a7-98a4fffbe5ba">
|
||||
<title>Empire</title>
|
||||
<status>Official</status>
|
||||
</release>
|
||||
<release id="dd34af03-37ab-460a-b20a-54629336d81a">
|
||||
<title>Empire</title>
|
||||
<status>Official</status>
|
||||
</release>
|
||||
</release-list>
|
||||
<tag-list>
|
||||
<tag count="3">
|
||||
<name>rock</name>
|
||||
</tag>
|
||||
<tag count="4">
|
||||
<name>alternative rock</name>
|
||||
</tag>
|
||||
<tag count="1">
|
||||
<name>indie</name>
|
||||
</tag>
|
||||
<tag count="1">
|
||||
<name>rock and indie</name>
|
||||
</tag>
|
||||
</tag-list>
|
||||
</release-group>
|
||||
<release-group id="246bc928-2dc8-35ba-80ee-7a0079de1632" type="Single" ext:score="100">
|
||||
<title>Empire</title>
|
||||
<primary-type>Single</primary-type>
|
||||
<artist-credit>
|
||||
<name-credit>
|
||||
<artist id="69b39eab-6577-46a4-a9f5-817839092033">
|
||||
<name>Kasabian</name>
|
||||
<sort-name>Kasabian</sort-name>
|
||||
</artist>
|
||||
</name-credit>
|
||||
</artist-credit>
|
||||
<release-list count="1">
|
||||
<release id="1da0d848-b937-4beb-8024-f4fdf6193708">
|
||||
<title>Empire</title>
|
||||
<status>Official</status>
|
||||
</release>
|
||||
</release-list>
|
||||
</release-group>
|
||||
</release-group-list>
|
||||
</metadata>
|
|
@ -28,10 +28,14 @@ describe MusicBrainz::ReleaseGroup do
|
|||
describe '.search' do
|
||||
context 'without type filter' do
|
||||
it "searches release group by artist name and title" do
|
||||
response = File.open(File.join(File.dirname(__FILE__), "../fixtures/release_group/search.xml")).read
|
||||
MusicBrainz::Client.any_instance.stub(:get_contents).with('http://musicbrainz.org/ws/2/release-group?query=artist:"Kasabian" AND releasegroup:"Empire"&limit=10').
|
||||
and_return({ status: 200, body: response})
|
||||
|
||||
matches = MusicBrainz::ReleaseGroup.search('Kasabian', 'Empire')
|
||||
matches.length.should be > 0
|
||||
matches.first[:title].should == 'Empire'
|
||||
matches.first[:type].should == 'Single'
|
||||
matches.first[:type].should == 'Album'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -47,8 +51,16 @@ describe MusicBrainz::ReleaseGroup do
|
|||
|
||||
describe '.find_by_artist_and_title' do
|
||||
it "gets first release group by artist name and title" do
|
||||
response = File.open(File.join(File.dirname(__FILE__), "../fixtures/release_group/search.xml")).read
|
||||
MusicBrainz::Client.any_instance.stub(:get_contents).with('http://musicbrainz.org/ws/2/release-group?query=artist:"Kasabian" AND releasegroup:"Empire"&limit=10').
|
||||
and_return({ status: 200, body: response})
|
||||
|
||||
response = File.open(File.join(File.dirname(__FILE__), "../fixtures/release_group/entity.xml")).read
|
||||
MusicBrainz::Client.any_instance.stub(:get_contents).with('http://musicbrainz.org/ws/2/release-group/6f33e0f0-cde2-38f9-9aee-2c60af8d1a61?inc=url-rels').
|
||||
and_return({ status: 200, body: response})
|
||||
|
||||
release_group = MusicBrainz::ReleaseGroup.find_by_artist_and_title('Kasabian', 'Empire')
|
||||
release_group.id.should == '246bc928-2dc8-35ba-80ee-7a0079de1632'
|
||||
release_group.id.should == '6f33e0f0-cde2-38f9-9aee-2c60af8d1a61'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue