rbrainz 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +13 -1
- data/LICENSE +1 -1
- data/README +2 -2
- data/Rakefile +2 -2
- data/TODO +9 -2
- data/doc/README.rdoc +5 -5
- data/examples/getartist.rb +3 -2
- data/examples/getlabel.rb +3 -2
- data/examples/getrelease.rb +5 -2
- data/examples/getreleasegroup.rb +53 -0
- data/examples/gettrack.rb +3 -2
- data/examples/getuser.rb +2 -1
- data/examples/rate.rb +44 -0
- data/examples/searchartists.rb +3 -2
- data/examples/searchcdstubs.rb +41 -0
- data/examples/searchlabels.rb +3 -2
- data/examples/searchreleasegroups.rb +36 -0
- data/examples/searchreleases.rb +6 -4
- data/examples/searchtracks.rb +3 -2
- data/examples/submit_isrcs.rb +52 -0
- data/examples/tag.rb +3 -2
- data/lib/rbrainz.rb +2 -1
- data/lib/rbrainz/core_ext.rb +2 -1
- data/lib/rbrainz/core_ext/mbid.rb +2 -1
- data/lib/rbrainz/core_ext/net_http_digest.rb +3 -2
- data/lib/rbrainz/core_ext/range.rb +3 -2
- data/lib/rbrainz/core_ext/range/equality.rb +2 -1
- data/lib/rbrainz/data/countrynames.rb +6 -3
- data/lib/rbrainz/data/languagenames.rb +3 -2
- data/lib/rbrainz/data/releasetypenames.rb +3 -2
- data/lib/rbrainz/data/scriptnames.rb +3 -2
- data/lib/rbrainz/model.rb +3 -2
- data/lib/rbrainz/model/alias.rb +3 -2
- data/lib/rbrainz/model/artist.rb +11 -3
- data/lib/rbrainz/model/collection.rb +3 -2
- data/lib/rbrainz/model/default_factory.rb +18 -6
- data/lib/rbrainz/model/disc.rb +3 -2
- data/lib/rbrainz/model/entity.rb +2 -102
- data/lib/rbrainz/model/incomplete_date.rb +3 -2
- data/lib/rbrainz/model/individual.rb +11 -2
- data/lib/rbrainz/model/isrc.rb +100 -0
- data/lib/rbrainz/model/label.rb +5 -2
- data/lib/rbrainz/model/mbid.rb +28 -9
- data/lib/rbrainz/model/rateable.rb +34 -0
- data/lib/rbrainz/model/rating.rb +56 -0
- data/lib/rbrainz/model/relateable.rb +118 -0
- data/lib/rbrainz/model/relation.rb +2 -1
- data/lib/rbrainz/model/release.rb +17 -3
- data/lib/rbrainz/model/release_event.rb +3 -2
- data/lib/rbrainz/model/release_group.rb +97 -0
- data/lib/rbrainz/model/scored_collection.rb +3 -2
- data/lib/rbrainz/model/tag.rb +5 -4
- data/lib/rbrainz/model/taggable.rb +27 -0
- data/lib/rbrainz/model/track.rb +15 -2
- data/lib/rbrainz/model/user.rb +3 -2
- data/lib/rbrainz/utils.rb +2 -1
- data/lib/rbrainz/utils/data.rb +3 -2
- data/lib/rbrainz/utils/helper.rb +8 -2
- data/lib/rbrainz/version.rb +3 -2
- data/lib/rbrainz/webservice.rb +12 -7
- data/lib/rbrainz/webservice/filter.rb +53 -4
- data/lib/rbrainz/webservice/includes.rb +72 -11
- data/lib/rbrainz/webservice/mbxml.rb +129 -67
- data/lib/rbrainz/webservice/query.rb +156 -16
- data/lib/rbrainz/webservice/webservice.rb +104 -116
- data/test/lib/mock_webservice.rb +9 -2
- data/test/lib/test_entity.rb +2 -97
- data/test/lib/test_factory.rb +9 -1
- data/test/lib/test_rateable.rb +31 -0
- data/test/lib/test_relateable.rb +103 -0
- data/test/lib/test_taggable.rb +36 -0
- data/test/lib/testing_helper.rb +17 -2
- data/test/test-data/invalid/artist/ratings_1.xml +6 -0
- data/test/test-data/invalid/artist/ratings_2.xml +6 -0
- data/test/test-data/valid/artist/Tchaikovsky-2.xml +6 -0
- data/test/test-data/valid/label/Atlantic_Records_3.xml +6 -0
- data/test/test-data/valid/release-group/The_Cure_1.xml +36 -0
- data/test/test-data/valid/release/Highway_61_Revisited_2.xml +6 -0
- data/test/test-data/valid/track/Silent_All_These_Years_4.xml +3 -0
- data/test/test-data/valid/track/Silent_All_These_Years_6.xml +8 -0
- data/test/test_alias.rb +2 -1
- data/test/test_artist.rb +24 -2
- data/test/test_artist_filter.rb +2 -1
- data/test/test_artist_includes.rb +13 -3
- data/test/test_collection.rb +3 -2
- data/test/test_default_factory.rb +8 -1
- data/test/test_disc.rb +2 -1
- data/test/test_incomplete_date.rb +2 -1
- data/test/test_isrc.rb +87 -0
- data/test/test_label.rb +8 -1
- data/test/test_label_filter.rb +2 -1
- data/test/test_label_includes.rb +10 -3
- data/test/test_mbid.rb +2 -1
- data/test/test_mbxml.rb +93 -2
- data/test/test_query.rb +68 -5
- data/test/test_range_equality.rb +2 -1
- data/test/test_rating.rb +46 -0
- data/test/test_relation.rb +2 -1
- data/test/test_release.rb +37 -2
- data/test/test_release_event.rb +2 -1
- data/test/test_release_filter.rb +15 -2
- data/test/test_release_group.rb +104 -0
- data/test/test_release_group_filter.rb +61 -0
- data/test/test_release_group_includes.rb +46 -0
- data/test/test_release_includes.rb +16 -3
- data/test/test_scored_collection.rb +3 -2
- data/test/test_tag.rb +2 -1
- data/test/test_track.rb +28 -1
- data/test/test_track_filter.rb +2 -1
- data/test/test_track_includes.rb +13 -3
- data/test/test_utils.rb +2 -1
- data/test/test_webservice.rb +11 -1
- metadata +38 -20
- data/debian/changelog +0 -11
- data/debian/compat +0 -1
- data/debian/control +0 -13
- data/debian/copyright +0 -25
- data/debian/rules +0 -48
data/test/lib/mock_webservice.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# $Id: mock_webservice.rb 273 2009-05-24 22:29:04Z phw $
|
2
3
|
#
|
3
4
|
# Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
|
4
5
|
# Copyright:: Copyright (c) 2007, Nigel Graham, Philipp Wolfer
|
@@ -26,6 +27,12 @@ class MockWebservice < MusicBrainz::Webservice::IWebservice
|
|
26
27
|
else
|
27
28
|
file = 'valid/artist/search_result_1.xml'
|
28
29
|
end
|
30
|
+
when :release_group
|
31
|
+
if options[:id]
|
32
|
+
file = 'valid/release-group/The_Cure_1.xml'
|
33
|
+
else
|
34
|
+
file = 'valid/release-group/search_result_1.xml'
|
35
|
+
end
|
29
36
|
when :release
|
30
37
|
if options[:id]
|
31
38
|
file = 'valid/release/Under_the_Pink_1.xml'
|
@@ -50,4 +57,4 @@ class MockWebservice < MusicBrainz::Webservice::IWebservice
|
|
50
57
|
return File.read(DATA_PATH + file)
|
51
58
|
end
|
52
59
|
|
53
|
-
end
|
60
|
+
end
|
data/test/lib/test_entity.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# $Id: test_entity.rb 254 2009-05-13 20:04:36Z phw $
|
2
3
|
#
|
3
4
|
# Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
|
4
5
|
# Copyright:: Copyright (c) 2007, Philipp Wolfer
|
@@ -52,100 +53,4 @@ module TestEntity
|
|
52
53
|
assert_equal nil, entity.id
|
53
54
|
end
|
54
55
|
|
55
|
-
def test_relations
|
56
|
-
entity = @tested_class.new
|
57
|
-
|
58
|
-
# Create some test relations
|
59
|
-
artist_rel = Model::Relation.new
|
60
|
-
artist_rel.target = Model::Artist.new
|
61
|
-
artist_rel.type = Model::NS_REL_1 + 'Vocal'
|
62
|
-
artist_rel.direction = Model::Relation::DIR_BACKWARD
|
63
|
-
artist_rel.attributes << Model::NS_REL_1 + 'Guest'
|
64
|
-
artist_rel.attributes << Model::NS_REL_1 + 'Lead'
|
65
|
-
assert_nothing_raised {entity.add_relation artist_rel}
|
66
|
-
|
67
|
-
track_rel = Model::Relation.new
|
68
|
-
track_rel.target = Model::Track.new
|
69
|
-
track_rel.type = Model::NS_REL_1 + 'Vocal'
|
70
|
-
track_rel.direction = Model::Relation::DIR_FORWARD
|
71
|
-
track_rel.attributes << Model::NS_REL_1 + 'Lead'
|
72
|
-
track_rel.attributes << Model::NS_REL_1 + 'Guest'
|
73
|
-
assert_nothing_raised {entity.add_relation track_rel}
|
74
|
-
|
75
|
-
url_rel = Model::Relation.new
|
76
|
-
url_rel.target = 'http://www.example.com'
|
77
|
-
url_rel.type = Model::NS_REL_1 + 'OfficialHomepage'
|
78
|
-
assert_nothing_raised {entity.add_relation url_rel}
|
79
|
-
|
80
|
-
# Get all relations
|
81
|
-
rel_list = []
|
82
|
-
assert_nothing_raised {rel_list = entity.get_relations()}
|
83
|
-
assert_equal 3, rel_list.size
|
84
|
-
assert rel_list.include?(artist_rel)
|
85
|
-
assert rel_list.include?(track_rel)
|
86
|
-
assert rel_list.include?(url_rel)
|
87
|
-
|
88
|
-
# Get only artist relation by target type
|
89
|
-
assert_nothing_raised {rel_list = entity.get_relations(
|
90
|
-
:target_type => Model::Relation::TO_ARTIST)}
|
91
|
-
assert_equal 1, rel_list.size
|
92
|
-
assert rel_list.include?(artist_rel)
|
93
|
-
|
94
|
-
# Get only artist relation by target type (without namespace)
|
95
|
-
assert_nothing_raised {rel_list = entity.get_relations(
|
96
|
-
:target_type => 'Artist')}
|
97
|
-
assert_equal 1, rel_list.size
|
98
|
-
assert rel_list.include?(artist_rel)
|
99
|
-
|
100
|
-
# Get only url relation type
|
101
|
-
assert_nothing_raised {rel_list = entity.get_relations(
|
102
|
-
:relation_type => Model::NS_REL_1 + 'OfficialHomepage')}
|
103
|
-
assert_equal 1, rel_list.size
|
104
|
-
assert rel_list.include?(url_rel)
|
105
|
-
|
106
|
-
# Get only url relation type (without namespace)
|
107
|
-
assert_nothing_raised {rel_list = entity.get_relations(
|
108
|
-
:relation_type => 'OfficialHomepage')}
|
109
|
-
assert_equal 1, rel_list.size
|
110
|
-
assert rel_list.include?(url_rel)
|
111
|
-
|
112
|
-
# Get only artist and track relation by attribute
|
113
|
-
assert_nothing_raised {rel_list = entity.get_relations(
|
114
|
-
:required_attributes => ['Guest', Model::NS_REL_1 + 'Lead'])}
|
115
|
-
assert_equal 2, rel_list.size
|
116
|
-
assert rel_list.include?(artist_rel)
|
117
|
-
assert rel_list.include?(track_rel)
|
118
|
-
|
119
|
-
# Get only artist relation by target type
|
120
|
-
assert_nothing_raised {rel_list = entity.get_relations(
|
121
|
-
:direction => Model::Relation::DIR_BACKWARD)}
|
122
|
-
assert_equal 1, rel_list.size
|
123
|
-
assert rel_list.include?(artist_rel)
|
124
|
-
|
125
|
-
# Test the target types
|
126
|
-
target_types = entity.relation_target_types
|
127
|
-
assert_equal 3, target_types.size, target_types.inspect
|
128
|
-
[Model::Relation::TO_ARTIST, Model::Relation::TO_TRACK,
|
129
|
-
Model::Relation::TO_URL].each {|type|
|
130
|
-
assert target_types.include?(type), target_types.inspect
|
131
|
-
}
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_tags
|
135
|
-
entity = @tested_class.new
|
136
|
-
tag1 = Model::Tag.new('doom metal')
|
137
|
-
tag2 = Model::Tag.new
|
138
|
-
|
139
|
-
assert_equal 0, entity.tags.size
|
140
|
-
assert_nothing_raised {entity.tags << tag1}
|
141
|
-
assert_equal 1, entity.tags.size
|
142
|
-
assert_nothing_raised {entity.tags << tag2}
|
143
|
-
assert_equal 2, entity.tags.size
|
144
|
-
|
145
|
-
assert_nothing_raised {entity.tags.delete tag2}
|
146
|
-
assert_equal 1, entity.tags.size
|
147
|
-
assert_nothing_raised {entity.tags.delete tag1}
|
148
|
-
assert_equal 0, entity.tags.size
|
149
|
-
end
|
150
|
-
|
151
56
|
end
|
data/test/lib/test_factory.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# $Id: test_factory.rb 273 2009-05-24 22:29:04Z phw $
|
2
3
|
#
|
3
4
|
# Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
|
4
5
|
# Copyright:: Copyright (c) 2007, Nigel Graham, Philipp Wolfer
|
@@ -14,6 +15,9 @@ end
|
|
14
15
|
class MyLabel < Model::Label
|
15
16
|
end
|
16
17
|
|
18
|
+
class MyReleaseGroup < Model::ReleaseGroup
|
19
|
+
end
|
20
|
+
|
17
21
|
class MyRelease < Model::Release
|
18
22
|
end
|
19
23
|
|
@@ -34,6 +38,10 @@ class MyFactory < Model::DefaultFactory
|
|
34
38
|
MyLabel.new
|
35
39
|
end
|
36
40
|
|
41
|
+
def new_release_group
|
42
|
+
MyReleaseGroup.new
|
43
|
+
end
|
44
|
+
|
37
45
|
def new_release
|
38
46
|
MyRelease.new
|
39
47
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# $Id: test_rateable.rb 254 2009-05-13 20:04:36Z phw $
|
3
|
+
#
|
4
|
+
# Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
|
5
|
+
# Copyright:: Copyright (c) 2009, Philipp Wolfer
|
6
|
+
# License:: RBrainz is free software distributed under a BSD style license.
|
7
|
+
# See LICENSE[file:../LICENSE.html] for permissions.
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
require 'rbrainz/model'
|
11
|
+
include MusicBrainz
|
12
|
+
|
13
|
+
# Unit test for the entity model.
|
14
|
+
# This is only a test module which defines general
|
15
|
+
# tests on entities which include the Rateable mixin.
|
16
|
+
# The tests should be executed by all subclass tests.
|
17
|
+
module TestRateable
|
18
|
+
|
19
|
+
def test_class_has_empty_rating
|
20
|
+
entity = @tested_class.new
|
21
|
+
assert entity.rating.is_a? Model::Rating
|
22
|
+
assert entity.rating.empty?
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_class_has_empty_user_rating
|
26
|
+
entity = @tested_class.new
|
27
|
+
assert entity.user_rating.is_a? Model::Rating
|
28
|
+
assert entity.user_rating.empty?
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# $Id: test_relateable.rb 254 2009-05-13 20:04:36Z phw $
|
3
|
+
#
|
4
|
+
# Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
|
5
|
+
# Copyright:: Copyright (c) 2009, Philipp Wolfer
|
6
|
+
# License:: RBrainz is free software distributed under a BSD style license.
|
7
|
+
# See LICENSE[file:../LICENSE.html] for permissions.
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
require 'rbrainz/model'
|
11
|
+
include MusicBrainz
|
12
|
+
|
13
|
+
# Unit test for the entity model.
|
14
|
+
# This is only a test module which defines general
|
15
|
+
# tests on entities which include the Relateable mixin.
|
16
|
+
# The tests should be executed by all subclass tests.
|
17
|
+
module TestRelateable
|
18
|
+
|
19
|
+
def test_relations
|
20
|
+
entity = @tested_class.new
|
21
|
+
|
22
|
+
# Create some test relations
|
23
|
+
artist_rel = Model::Relation.new
|
24
|
+
artist_rel.target = Model::Artist.new
|
25
|
+
artist_rel.type = Model::NS_REL_1 + 'Vocal'
|
26
|
+
artist_rel.direction = Model::Relation::DIR_BACKWARD
|
27
|
+
artist_rel.attributes << Model::NS_REL_1 + 'Guest'
|
28
|
+
artist_rel.attributes << Model::NS_REL_1 + 'Lead'
|
29
|
+
assert_nothing_raised {entity.add_relation artist_rel}
|
30
|
+
|
31
|
+
track_rel = Model::Relation.new
|
32
|
+
track_rel.target = Model::Track.new
|
33
|
+
track_rel.type = Model::NS_REL_1 + 'Vocal'
|
34
|
+
track_rel.direction = Model::Relation::DIR_FORWARD
|
35
|
+
track_rel.attributes << Model::NS_REL_1 + 'Lead'
|
36
|
+
track_rel.attributes << Model::NS_REL_1 + 'Guest'
|
37
|
+
assert_nothing_raised {entity.add_relation track_rel}
|
38
|
+
|
39
|
+
url_rel = Model::Relation.new
|
40
|
+
url_rel.target = 'http://www.example.com'
|
41
|
+
url_rel.type = Model::NS_REL_1 + 'OfficialHomepage'
|
42
|
+
assert_nothing_raised {entity.add_relation url_rel}
|
43
|
+
|
44
|
+
# Get all relations
|
45
|
+
rel_list = []
|
46
|
+
assert_nothing_raised {rel_list = entity.get_relations()}
|
47
|
+
assert_equal 3, rel_list.size
|
48
|
+
assert rel_list.include?(artist_rel)
|
49
|
+
assert rel_list.include?(track_rel)
|
50
|
+
assert rel_list.include?(url_rel)
|
51
|
+
|
52
|
+
# Get only artist relation by target type
|
53
|
+
assert_nothing_raised {rel_list = entity.get_relations(
|
54
|
+
:target_type => Model::Relation::TO_ARTIST)}
|
55
|
+
assert_equal 1, rel_list.size
|
56
|
+
assert rel_list.include?(artist_rel)
|
57
|
+
|
58
|
+
# Get only artist relation by target type (without namespace)
|
59
|
+
assert_nothing_raised {rel_list = entity.get_relations(
|
60
|
+
:target_type => 'Artist')}
|
61
|
+
assert_equal 1, rel_list.size
|
62
|
+
assert rel_list.include?(artist_rel)
|
63
|
+
|
64
|
+
# Get only url relation type
|
65
|
+
assert_nothing_raised {rel_list = entity.get_relations(
|
66
|
+
:relation_type => Model::NS_REL_1 + 'OfficialHomepage')}
|
67
|
+
assert_equal 1, rel_list.size
|
68
|
+
assert rel_list.include?(url_rel)
|
69
|
+
|
70
|
+
# Get only url relation type (without namespace)
|
71
|
+
assert_nothing_raised {rel_list = entity.get_relations(
|
72
|
+
:relation_type => 'OfficialHomepage')}
|
73
|
+
assert_equal 1, rel_list.size
|
74
|
+
assert rel_list.include?(url_rel)
|
75
|
+
|
76
|
+
# Get only artist and track relation by attribute
|
77
|
+
assert_nothing_raised {rel_list = entity.get_relations(
|
78
|
+
:required_attributes => ['Guest', Model::NS_REL_1 + 'Lead'])}
|
79
|
+
assert_equal 2, rel_list.size
|
80
|
+
assert rel_list.include?(artist_rel)
|
81
|
+
assert rel_list.include?(track_rel)
|
82
|
+
|
83
|
+
# Get only artist relation by target type
|
84
|
+
assert_nothing_raised {rel_list = entity.get_relations(
|
85
|
+
:direction => Model::Relation::DIR_BACKWARD)}
|
86
|
+
assert_equal 1, rel_list.size
|
87
|
+
assert rel_list.include?(artist_rel)
|
88
|
+
|
89
|
+
# Test the target types
|
90
|
+
target_types = entity.relation_target_types
|
91
|
+
assert_equal 3, target_types.size, target_types.inspect
|
92
|
+
[Model::Relation::TO_ARTIST, Model::Relation::TO_TRACK,
|
93
|
+
Model::Relation::TO_URL].each {|type|
|
94
|
+
assert target_types.include?(type), target_types.inspect
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_no_direct_acces_to_relations
|
99
|
+
entity = @tested_class.new
|
100
|
+
assert_raise(NoMethodError) { entity.relations }
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# $Id: test_taggable.rb 254 2009-05-13 20:04:36Z phw $
|
3
|
+
#
|
4
|
+
# Author:: Philipp Wolfer (mailto:phw@rubyforge.org)
|
5
|
+
# Copyright:: Copyright (c) 2009, Philipp Wolfer
|
6
|
+
# License:: RBrainz is free software distributed under a BSD style license.
|
7
|
+
# See LICENSE[file:../LICENSE.html] for permissions.
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
require 'rbrainz/model'
|
11
|
+
include MusicBrainz
|
12
|
+
|
13
|
+
# Unit test for the entity model.
|
14
|
+
# This is only a test module which defines general
|
15
|
+
# tests on entities which include the Taggable mixin.
|
16
|
+
# The tests should be executed by all subclass tests.
|
17
|
+
module TestTaggable
|
18
|
+
|
19
|
+
def test_tags
|
20
|
+
entity = @tested_class.new
|
21
|
+
tag1 = Model::Tag.new('doom metal')
|
22
|
+
tag2 = Model::Tag.new
|
23
|
+
|
24
|
+
assert_equal 0, entity.tags.size
|
25
|
+
assert_nothing_raised {entity.tags << tag1}
|
26
|
+
assert_equal 1, entity.tags.size
|
27
|
+
assert_nothing_raised {entity.tags << tag2}
|
28
|
+
assert_equal 2, entity.tags.size
|
29
|
+
|
30
|
+
assert_nothing_raised {entity.tags.delete tag2}
|
31
|
+
assert_equal 1, entity.tags.size
|
32
|
+
assert_nothing_raised {entity.tags.delete tag1}
|
33
|
+
assert_equal 0, entity.tags.size
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/test/lib/testing_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# $Id: testing_helper.rb 254 2009-05-13 20:04:36Z phw $
|
2
3
|
#
|
3
4
|
# Usefull helper methods which are used in different test classes.
|
4
5
|
#
|
@@ -13,4 +14,18 @@ def query_string_to_hash query_string
|
|
13
14
|
v.gsub!('+', ' ')
|
14
15
|
v.gsub!(/%([0-9a-f]{2})/i) { [$1.hex].pack 'C' }
|
15
16
|
}
|
16
|
-
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# True, if parent_class is one of the parent classes of child_class
|
20
|
+
def assert_inherited_from child_class, parent_class, message=nil
|
21
|
+
result = false
|
22
|
+
klass = child_class
|
23
|
+
while not klass.nil?
|
24
|
+
if klass == parent_class
|
25
|
+
result = true
|
26
|
+
break
|
27
|
+
end
|
28
|
+
klass = klass.superclass
|
29
|
+
end
|
30
|
+
assert(result, message)
|
31
|
+
end
|
@@ -8,5 +8,11 @@
|
|
8
8
|
<tag count="40">romantic era</tag>
|
9
9
|
<tag count="120">composer</tag>
|
10
10
|
</tag-list>
|
11
|
+
<user-tag-list>
|
12
|
+
<user-tag>classical</user-tag>
|
13
|
+
<user-tag>russian</user-tag>
|
14
|
+
</user-tag-list>
|
15
|
+
<rating votes-count="10">4.5</rating>
|
16
|
+
<user-rating>3</user-rating>
|
11
17
|
</artist>
|
12
18
|
</metadata>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<metadata xmlns="http://musicbrainz.org/ns/mmd-1.0#" xmlns:ext="http://musicbrainz.org/ns/ext-1.0#">
|
3
|
+
<release-group id="c6a62b78-70f7-44f7-b159-064f6b7ba03a" type="Album">
|
4
|
+
<title>The Cure</title>
|
5
|
+
<artist id="69ee3720-a7cb-4402-b48d-a02c366f2bcf" type="Group">
|
6
|
+
<name>The Cure</name>
|
7
|
+
<sort-name>Cure, The</sort-name>
|
8
|
+
<life-span begin="1977"/>
|
9
|
+
</artist>
|
10
|
+
<release-list>
|
11
|
+
<release id="d984e1a3-7281-46bb-ad8b-1478a00f2fbf" type="Album Official">
|
12
|
+
<title>The Cure</title>
|
13
|
+
<text-representation language="ENG" script="Latn"/>
|
14
|
+
<asin>B0002CHGZI</asin>
|
15
|
+
<track-list offset="11"/>
|
16
|
+
</release>
|
17
|
+
<release id="c100a398-3132-48a8-a5fc-c3e908ac17dc" type="Album Official">
|
18
|
+
<title>The Cure</title>
|
19
|
+
<text-representation language="ENG" script="Latn"/>
|
20
|
+
<track-list offset="14"/>
|
21
|
+
</release>
|
22
|
+
<release id="24bec892-b21d-47d8-a288-dc6450152574" type="Album Official">
|
23
|
+
<title>The Cure</title>
|
24
|
+
<text-representation language="ENG" script="Latn"/>
|
25
|
+
<asin>B0002C9G7O</asin>
|
26
|
+
<track-list offset="12"/>
|
27
|
+
</release>
|
28
|
+
<release id="61a4ec51-fa34-4757-85d7-83231776ed14" type="Album Official">
|
29
|
+
<title>The Cure</title>
|
30
|
+
<text-representation language="ENG" script="Latn"/>
|
31
|
+
<asin>B00028HOFY</asin>
|
32
|
+
<track-list offset="10"/>
|
33
|
+
</release>
|
34
|
+
</release-list>
|
35
|
+
</release-group>
|
36
|
+
</metadata>
|
@@ -8,5 +8,11 @@
|
|
8
8
|
<tag count="40">folk rock</tag>
|
9
9
|
<tag count="4">dylan</tag>
|
10
10
|
</tag-list>
|
11
|
+
<user-tag-list>
|
12
|
+
<user-tag>rock</user-tag>
|
13
|
+
<user-tag>foo</user-tag>
|
14
|
+
</user-tag-list>
|
15
|
+
<rating votes-count="10">4.5</rating>
|
16
|
+
<user-rating>3</user-rating>
|
11
17
|
</release>
|
12
18
|
</metadata>
|