Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 4698 Bytes
1 | require 'flickr' |
2 | require 'test/unit' |
3 | #require 'stringio' |
4 | |
5 | class MockFlickr < Flickr |
6 | #@@data = eval(DATA.read) |
7 | #def _get_response(url) |
8 | # raise "no data for #{url.inspect}" unless @@data.has_key? url |
9 | # return REXML::Document.new(@@data[url]) |
10 | #end |
11 | end |
12 | |
13 | class TestFlickr < Test::Unit::TestCase |
14 | |
15 | def setup |
16 | @api_key = '86e18ef2a064ff2255845e029208d7f4' |
17 | @email = 'sco@redgreenblu.com' |
18 | @password = 'flickr.rb' |
19 | @username = 'flickr.rb' |
20 | @user_id = '35034359890@N01' |
21 | @photo_id = '8649502' |
22 | @tag = 'onetag' |
23 | @tags = 'onetag twotag' |
24 | @tag_id = '27359619' |
25 | @date_posted = '2005-01-01 16:01:26' |
26 | @dates = '1093566950' |
27 | @group_id = '37718676860@N01' |
28 | @group_url = 'http://flickr.com/groups/kansascity/' |
29 | @user_url = 'http://flickr.com/photos/sco/' |
30 | @title = 'New Set' |
31 | @f = MockFlickr.new |
32 | @f.login(@email, @password) |
33 | @u = @f.users(@email) |
34 | end |
35 | |
36 | |
37 | ##### DIRECT MODE |
38 | |
39 | def test_test_echo |
40 | assert_equal @f.test_echo['stat'], 'ok' |
41 | end |
42 | def test_test_login |
43 | assert_equal @f.test_login['stat'], 'ok' |
44 | end |
45 | |
46 | |
47 | ##### BASICS |
48 | |
49 | def test_request |
50 | assert_equal @f.request('test.echo')['stat'], 'ok' |
51 | end |
52 | |
53 | def test_request_url |
54 | assert_equal "http://flickr.com/services/rest/?api_key=#{@api_key}&method=flickr.test.echo&foo=bar&email=#{@email}&password=#{@password}", @f.request_url('test.echo', ['foo'=>'bar']) |
55 | end |
56 | |
57 | def test_login |
58 | assert_equal @username, @f.user.getInfo.username |
59 | end |
60 | |
61 | def test_find_by_url |
62 | assert_equal @group_id, @f.find_by_url(@group_url).getInfo.id # find group by URL |
63 | assert_equal @user_id, @f.find_by_url(@user_url).getInfo.id # find user by URL |
64 | end |
65 | |
66 | def test_photos |
67 | assert_equal 100, @f.photos.size # find recent |
68 | assert_equal @user_id, @f.photos('user_id'=>@user_id).first.getInfo.owner.id # search by user_id |
69 | end |
70 | |
71 | def test_users |
72 | assert_equal @username, @f.users(@email).getInfo.username # find by email |
73 | assert_equal @username, @f.users(@username).getInfo.username # find by username |
74 | assert_kind_of Flickr::User, @f.users.first # find all online users |
75 | end |
76 | |
77 | def test_groups |
78 | assert_kind_of Flickr::Group, @f.groups.first # find all active groups |
79 | end |
80 | |
81 | def test_licenses |
82 | assert_kind_of Array, @f.licenses # find all licenses |
83 | end |
84 | |
85 | |
86 | ##### USER |
87 | |
88 | def test_getInfo |
89 | @u.getInfo |
90 | assert_equal @username, @u.username |
91 | end |
92 | |
93 | def test_groups |
94 | assert_kind_of Flickr::Group, @u.groups.first # public groups |
95 | end |
96 | |
97 | def test_photos |
98 | assert_kind_of Flickr::Photo, @u.photos.first # public photos |
99 | end |
100 | |
101 | def test_contacts |
102 | assert_kind_of Flickr::User, @u.contacts.first # public contacts |
103 | end |
104 | |
105 | def test_favorites |
106 | assert_kind_of Flickr::Photo, @u.favorites.first # public favorites |
107 | end |
108 | |
109 | def test_photosets |
110 | assert_kind_of Flickr::Photoset, @u.photosets.first # public photosets |
111 | end |
112 | |
113 | def test_tags |
114 | assert_kind_of Array, @u.tags # tags |
115 | end |
116 | |
117 | def test_contactsPhotos |
118 | assert_kind_of Flickr::Photo, @u.contactsPhotos.first # contacts' favorites |
119 | end |
120 | |
121 | |
122 | ##### PHOTO |
123 | |
124 | def test_getInfo |
125 | @p.getInfo |
126 | assert_equal @photo_id, @p.id |
127 | end |
128 | |
129 | |
130 | ##### PHOTOSETS |
131 | |
132 | #def setup |
133 | # super |
134 | # @photoset = @f.photosets_create('title'=>@title, 'primary_photo_id'=>@photo_id) |
135 | # @photoset_id = @photoset['photoset']['id'] |
136 | #end |
137 | #def teardown |
138 | # @f.photosets_delete('photoset_id'=>@photoset_id) |
139 | #end |
140 | |
141 | def test_photosets_editMeta |
142 | assert_equal @f.photosets_editMeta('photoset_id'=>@photoset_id, 'title'=>@title)['stat'], 'ok' |
143 | end |
144 | |
145 | def test_photosets_editPhotos |
146 | assert_equal @f.photosets_editPhotos('photoset_id'=>@photoset_id, 'primary_photo_id'=>@photo_id, 'photo_ids'=>@photo_id)['stat'], 'ok' |
147 | end |
148 | |
149 | def test_photosets_getContext |
150 | assert_equal @f.photosets_getContext('photoset_id'=>@photoset_id, 'photo_id'=>@photo_id)['stat'], 'ok' |
151 | end |
152 | |
153 | def test_photosets_getContext |
154 | assert_equal @f.photosets_getContext('photoset_id'=>@photoset_id, 'photo_id'=>@photo_id)['stat'], 'ok' |
155 | end |
156 | |
157 | def test_photosets_getInfo |
158 | assert_equal @f.photosets_getInfo('photoset_id'=>@photoset_id)['stat'], 'ok' |
159 | end |
160 | |
161 | def test_photosets_getList |
162 | assert_equal @f.photosets_getList['stat'], 'ok' |
163 | end |
164 | |
165 | def test_photosets_getPhotos |
166 | assert_equal @f.photosets_getPhotos('photoset_id'=>@photoset_id)['stat'], 'ok' |
167 | end |
168 | |
169 | def test_photosets_orderSets |
170 | assert_equal @f.photosets_orderSets('photoset_ids'=>@photoset_id)['stat'], 'ok' |
171 | end |
172 | |
173 | end |