rbrainz 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_release.rb CHANGED
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: test_release.rb 30 2007-05-29 02:12:33Z phw $
2
2
  # Copyright (c) 2007, Philipp Wolfer
3
3
  # All rights reserved.
4
4
  # See LICENSE for permissions.
@@ -107,13 +107,6 @@ class TestRelease < Test::Unit::TestCase
107
107
  assert_equal 0, release.tracks.size
108
108
  end
109
109
 
110
- # You can pass an array of tracks to add them all.
111
- def test_add_several_tracks_at_once
112
- release = Model::Release.new
113
- assert_nothing_raised {release.tracks = @tracks}
114
- assert_equal @tracks, release.tracks
115
- end
116
-
117
110
  # Many release events can be added
118
111
  def test_add_and_remove_release_events
119
112
  release = Model::Release.new
@@ -129,13 +122,6 @@ class TestRelease < Test::Unit::TestCase
129
122
  assert_equal 0, release.release_events.size
130
123
  end
131
124
 
132
- # You can pass an array of aliases to add them all.
133
- def test_add_several_release_events_at_once
134
- release = Model::Release.new
135
- assert_nothing_raised {release.release_events = @release_events}
136
- assert_equal @release_events, release.release_events
137
- end
138
-
139
125
  # Many discs can be added
140
126
  def test_add_and_remove_disc
141
127
  release = Model::Release.new
@@ -151,11 +137,4 @@ class TestRelease < Test::Unit::TestCase
151
137
  assert_equal 0, release.discs.size
152
138
  end
153
139
 
154
- # You can pass an array of discs to add them all.
155
- def test_add_several_discs_at_once
156
- release = Model::Release.new
157
- assert_nothing_raised {release.discs = @discs}
158
- assert_equal @discs, release.discs
159
- end
160
-
161
140
  end
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: test_release_event.rb 27 2007-05-28 23:15:21Z phw $
2
2
  # Copyright (c) 2007, Philipp Wolfer
3
3
  # All rights reserved.
4
4
  # See LICENSE for permissions.
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: test_release_filter.rb 27 2007-05-28 23:15:21Z phw $
2
2
  # Copyright (c) 2007, Philipp Wolfer
3
3
  # All rights reserved.
4
4
  # See LICENSE for permissions.
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: test_release_includes.rb 27 2007-05-28 23:15:21Z phw $
2
2
  # Copyright (c) 2007, Philipp Wolfer
3
3
  # All rights reserved.
4
4
  # See LICENSE for permissions.
data/test/test_track.rb CHANGED
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: test_track.rb 30 2007-05-29 02:12:33Z phw $
2
2
  # Copyright (c) 2007, Philipp Wolfer
3
3
  # All rights reserved.
4
4
  # See LICENSE for permissions.
@@ -70,13 +70,6 @@ class TestTrack < Test::Unit::TestCase
70
70
  assert_equal 0, track.puids.size
71
71
  end
72
72
 
73
- # You can pass an array of PUIDs to add them all.
74
- def test_add_several_puids_at_once
75
- track = Model::Track.new
76
- assert_nothing_raised {track.puids = @valid_puids}
77
- assert_equal @valid_puids, track.puids
78
- end
79
-
80
73
  # Many releases can be added
81
74
  def test_add_and_remove_releases
82
75
  track = Model::Track.new
@@ -92,11 +85,4 @@ class TestTrack < Test::Unit::TestCase
92
85
  assert_equal 0, track.releases.size
93
86
  end
94
87
 
95
- # You can pass an array of releases to add them all.
96
- def test_add_several_releases_at_once
97
- track = Model::Track.new
98
- assert_nothing_raised {track.releases = @releases}
99
- assert_equal @releases, track.releases
100
- end
101
-
102
88
  end
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: test_track_filter.rb 27 2007-05-28 23:15:21Z phw $
2
2
  # Copyright (c) 2007, Philipp Wolfer
3
3
  # All rights reserved.
4
4
  # See LICENSE for permissions.
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: test_track_includes.rb 27 2007-05-28 23:15:21Z phw $
2
2
  # Copyright (c) 2007, Philipp Wolfer
3
3
  # All rights reserved.
4
4
  # See LICENSE for permissions.
@@ -1,4 +1,4 @@
1
- # $Id$
1
+ # $Id: test_webservice.rb 36 2007-05-29 18:43:36Z phw $
2
2
  # Copyright (c) 2007, Philipp Wolfer
3
3
  # All rights reserved.
4
4
  # See LICENSE for permissions.
@@ -11,13 +11,52 @@ include MusicBrainz
11
11
  class TestWebservice < Test::Unit::TestCase
12
12
 
13
13
  def setup
14
+ # See http://wiki.musicbrainz.org/TestServer
15
+ @testserver = 'test.musicbrainz.org'
14
16
  end
15
17
 
16
18
  def teardown
17
19
  end
18
20
 
19
- def test_not_implemented
20
- assert false, 'Unit test for ' + self.class.name + ' not implemented!'
21
+ def test_get_success
22
+ ws = Webservice::Webservice.new(:host => @testserver)
23
+ assert_nothing_raised {
24
+ ws.get(:artist, Model::MBID.from_uuid(:artist, '10bf95b6-30e3-44f1-817f-45762cdc0de0'))
25
+ }
26
+ end
27
+
28
+ # 400 - Bad Request
29
+ def test_get_request_error
30
+ ws = Webservice::Webservice.new(:host => @testserver)
31
+ assert_raise(Webservice::RequestError) {
32
+ ws.get(:artist, Model::MBID.from_uuid(:artist, '10bf95b6-30e3-44f1-817f-45762cdc0de0'),
33
+ :include => 'inc=invalid')
34
+ }
35
+ end
36
+
37
+ # 401 - Unauthorized
38
+ # Not implemented, yet.
39
+ #def test_get_authentication_error
40
+ # ws = Webservice::Webservice.new(:host => @testserver)
41
+ # assert_raise(Webservice::AuthenticationError) {
42
+ # #...
43
+ # }
44
+ #end
45
+
46
+ # 404 - Not Found
47
+ def test_get_resource_not_found_error
48
+ ws = Webservice::Webservice.new(:host => @testserver, :path_prefix => '/invalid')
49
+ assert_raise(Webservice::ResourceNotFoundError) {
50
+ ws.get(:artist, Model::MBID.from_uuid(:artist, '10bf95b6-30e3-44f1-817f-45762cdc0de0'))
51
+ }
52
+ end
53
+
54
+ def test_get_connection_error
55
+ ws = Webservice::Webservice.new(:host => 'example.org')
56
+ ws.open_timeout = 0.1
57
+ assert_raise(Webservice::ConnectionError) {
58
+ ws.get(:artist, Model::MBID.from_uuid(:artist, '10bf95b6-30e3-44f1-817f-45762cdc0de0'))
59
+ }
21
60
  end
22
61
 
23
62
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rbrainz
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2007-05-23 00:00:00 +02:00
6
+ version: 0.1.1
7
+ date: 2007-05-29 00:00:00 +02:00
8
8
  summary: Ruby library for the MusicBrainz XML webservice.
9
9
  require_paths:
10
10
  - lib
@@ -43,6 +43,7 @@ files:
43
43
  - lib/rbrainz/model/mbid.rb
44
44
  - lib/rbrainz/model/label.rb
45
45
  - lib/rbrainz/model/release.rb
46
+ - lib/rbrainz/model/relation.rb
46
47
  - lib/rbrainz/model/track.rb
47
48
  - lib/rbrainz/model/incomplete_date.rb
48
49
  - lib/rbrainz/model/release_event.rb
@@ -75,6 +76,7 @@ files:
75
76
  - test/test_artist.rb
76
77
  - test/test_incomplete_date.rb
77
78
  - test/test_query.rb
79
+ - test/test_relation.rb
78
80
  - test/test_alias.rb
79
81
  - test/lib/test_entity.rb
80
82
  - test/lib/testing_helper.rb