r43 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/r43.rb +366 -232
- data/lib/{city.rb → r43/city.rb} +0 -0
- data/lib/{entry.rb → r43/entry.rb} +0 -0
- data/lib/{goal.rb → r43/goal.rb} +0 -0
- data/lib/{id.rb → r43/id.rb} +1 -1
- data/lib/{person.rb → r43/person.rb} +0 -0
- data/lib/{tag.rb → r43/tag.rb} +0 -0
- data/test/es-get_persons_tags-Alvaro.xml +10 -0
- data/test/get_city-1164.xml +8 -0
- data/test/get_goal_by_id-533.xml +18 -0
- data/test/get_tags_goals-travel-offset20.xml +152 -0
- data/test/get_tags_goals-travel-offset80-max10.xml +82 -0
- data/test/get_tags_goals-travel.xml +152 -0
- data/test/get_tags_similarities-travel.xml +12 -0
- data/test/get_teams_progress-222591.xml +170 -0
- data/test/get_teams_progress-7.xml +146 -0
- data/test/idea-get_person-pate.xml +48 -0
- data/test/search_tags-lose+weight.xml +48 -0
- data/test/search_tags-travel-offset20.xml +36 -0
- data/test/search_tags-travel.xml +39 -0
- data/test/test_r43.rb +307 -38
- metadata +22 -10
- data/lib/r43.rb.~1.6.~ +0 -645
- data/test/test_r43.rb.~1.8.~ +0 -728
data/test/test_r43.rb.~1.8.~
DELETED
@@ -1,728 +0,0 @@
|
|
1
|
-
# copyright 2005 Pat Eyler, Sean Carley, & Edward Cho
|
2
|
-
# distributed under the same terms as Ruby
|
3
|
-
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
require 'r43'
|
7
|
-
require 'stringio'
|
8
|
-
|
9
|
-
class FakeService < R43::Service
|
10
|
-
|
11
|
-
#
|
12
|
-
# collection of mock XML responses
|
13
|
-
#
|
14
|
-
@@data = {
|
15
|
-
|
16
|
-
#
|
17
|
-
# General Methods
|
18
|
-
#
|
19
|
-
"authentication_test?api_key=1234&username=www&password=1234" =>
|
20
|
-
"#{File.open('test/authentication.xml').read}",
|
21
|
-
"echo?api_key=1234" =>
|
22
|
-
"#{File.open('test/echo.xml').read}",
|
23
|
-
|
24
|
-
#
|
25
|
-
# Goal Methods
|
26
|
-
"search_goals?api_key=1234&q=schemer" =>
|
27
|
-
"#{File.open('test/search_goals-schemer.xml').read}",
|
28
|
-
"search_goals?api_key=1234&q=ruby" =>
|
29
|
-
"#{File.open('test/search_goals-ruby.xml').read}",
|
30
|
-
"search_goals?api_key=1234&q=ruby&offset=20" =>
|
31
|
-
"#{File.open('test/search_goals-ruby-offset20.xml').read}",
|
32
|
-
"search_goals?api_key=1234&q=ruby&offset=20&max=10" =>
|
33
|
-
"#{File.open('test/search_goals-ruby-offset20-max10.xml').read}",
|
34
|
-
"get_goal_by_id?api_key=1234&id=255" =>
|
35
|
-
"#{File.open('test/get_goal_by_id-255.xml').read}",
|
36
|
-
"get_goal_by_name?api_key=1234&name=Try+out+43+Things" =>
|
37
|
-
"#{File.open('test/get_goal_by_name-255.xml').read}",
|
38
|
-
"get_goals_similarities?api_key=1234&id=255" =>
|
39
|
-
"#{File.open('test/get_goals_similarities-255.xml').read}",
|
40
|
-
"get_goals_people?api_key=1234&id=533" =>
|
41
|
-
"#{File.open('test/get_goals_people-533.xml').read}",
|
42
|
-
"get_goals_people?api_key=1234&id=533&offset=20" =>
|
43
|
-
"#{File.open('test/get_goals_people-533-offset20.xml').read}",
|
44
|
-
"get_goals_entries?api_key=1234&id=533" =>
|
45
|
-
"#{File.open('test/get_goals_entries-533.xml').read}",
|
46
|
-
"get_goals_entries?api_key=1234&id=255&offset=20&max=10&view=done" =>
|
47
|
-
"#{File.open('test/get_goals_entries-255-offset20.xml').read}",
|
48
|
-
|
49
|
-
#
|
50
|
-
# People Methods
|
51
|
-
"get_person?api_key=1234&id=erik" =>
|
52
|
-
"#{File.open('test/get_person-erik.xml').read}",
|
53
|
-
"get_person?api_key=1234&id=sweeting" =>
|
54
|
-
"#{File.open('test/get_person-sweeting.xml').read}",
|
55
|
-
"get_person?api_key=1234&flickr_username=erikbenson" =>
|
56
|
-
"#{File.open('test/get_person-flickr_username.xml').read}",
|
57
|
-
|
58
|
-
#
|
59
|
-
# Team Methods
|
60
|
-
|
61
|
-
#
|
62
|
-
# Entry Methods
|
63
|
-
"get_entry?api_key=1234&id=33" =>
|
64
|
-
"#{File.open('test/get_entry-33.xml').read}",
|
65
|
-
|
66
|
-
#
|
67
|
-
# Tag Methods
|
68
|
-
|
69
|
-
#
|
70
|
-
# City Methods
|
71
|
-
"search_cities?api_key=1234&q=london" =>
|
72
|
-
"#{File.open('test/search_cities-london.xml').read}",
|
73
|
-
"get_city?api_key=1234&id=36" =>
|
74
|
-
"#{File.open('test/get_city-36.xml').read}",
|
75
|
-
"get_citys_people?api_key=1234&id=1164" =>
|
76
|
-
"#{File.open('test/get_citys_people-1164.xml').read}",
|
77
|
-
"get_citys_people?api_key=1234&id=1164&offset=20&max=20" =>
|
78
|
-
"#{File.open('test/get_citys_people-1164-offset20.xml').read}"
|
79
|
-
|
80
|
-
#
|
81
|
-
# Action Methods
|
82
|
-
|
83
|
-
#
|
84
|
-
# ATOM Methods
|
85
|
-
}
|
86
|
-
|
87
|
-
|
88
|
-
def _get_response(url)
|
89
|
-
raise "no data for #{url.inspect}" unless @@data.has_key? url
|
90
|
-
return REXML::Document.new(@@data[url])
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
class FakeRequest < R43::Request
|
95
|
-
def initialize(key)
|
96
|
-
super key
|
97
|
-
@service = FakeService.new key
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
class TestRequest < Test::Unit::TestCase
|
104
|
-
|
105
|
-
def setup
|
106
|
-
@connection = FakeRequest.new('1234')
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_key
|
110
|
-
assert_equal('1234',@connection.service.key)
|
111
|
-
newconn = FakeRequest.new(1234)
|
112
|
-
assert_equal('1234',newconn.service.key)
|
113
|
-
newconn = FakeRequest.new(['1','2','3','4'])
|
114
|
-
assert_equal('1234',newconn.service.key)
|
115
|
-
end
|
116
|
-
|
117
|
-
def test_echo
|
118
|
-
assert_equal({"action"=>"echo",
|
119
|
-
"api_key"=>"1234",
|
120
|
-
"controller"=>"service"},
|
121
|
-
@connection.echo)
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_authentication_test
|
125
|
-
assert_equal("true", @connection.authentication_test("www","1234"))
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_get_entry
|
129
|
-
content = "It's odd to say that the objective is survival rather than huge market success. But just making it work and sticking to it is the objective I'm after. Hopefully, by making sure the product we develop is meaningful and the work set-up is friendly and fun, drudgery will be held in abeyance and the world will be positively impacted by what we do.\\n\\nAnyway, about 2-3 times a day I'm struck with some paranoid thought or shuddering fear about making sure the company is still here in 2-3 years. It's like an internal emotional tide. Here comes the wave of utter terror! There goes the tide of dread and its a cresting wave of happiness again."
|
130
|
-
|
131
|
-
entry = @connection.get_entry(33)
|
132
|
-
assert_equal("Started - September 2004", entry.title)
|
133
|
-
assert_instance_of(Person, entry.author)
|
134
|
-
assert_equal("Josh Petersen", entry.author.name)
|
135
|
-
assert_equal("start a company that survives longer than 2 years",
|
136
|
-
entry.dc_subject)
|
137
|
-
assert_instance_of(Goal, entry.goal)
|
138
|
-
assert_equal(9, entry.goal.goal_id)
|
139
|
-
assert_equal(163, entry.goal.num_registered_people)
|
140
|
-
assert_equal(content, entry.content)
|
141
|
-
assert_equal(1, entry.num_comments)
|
142
|
-
assert_equal("2004-12-02T00:43:50Z", entry.issued)
|
143
|
-
assert_equal("http://www.43things.com/entries/view/33", entry.link)
|
144
|
-
assert_equal("tag:43things.com:joshp:entry:33", entry.id)
|
145
|
-
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
def test_get_goal_by_id
|
150
|
-
goal = @connection.get_goal_by_id(255)
|
151
|
-
assert_instance_of(Goal, goal)
|
152
|
-
assert_equal("Try out 43 Things", goal.name)
|
153
|
-
assert_equal("http://www.43things.com/things/view/255",
|
154
|
-
goal.link)
|
155
|
-
assert_equal(903, goal.num_registered_people)
|
156
|
-
assert_equal(180, goal.num_unregistered_people)
|
157
|
-
assert_equal(352, goal.num_say_worth_it)
|
158
|
-
assert_equal(21, goal.num_say_not_worth_it)
|
159
|
-
assert_equal(94, goal.percentage_worth_it)
|
160
|
-
assert_equal(["43 things","testing","beta","beta test","blog"], goal.tags)
|
161
|
-
assert_equal("tag:43things.com:goal:255",goal.id)
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_get_goal_by_name
|
165
|
-
goal = @connection.get_goal_by_name("Try out 43 Things")
|
166
|
-
assert_instance_of(Goal, goal)
|
167
|
-
assert_equal("Try out 43 Things", goal.name)
|
168
|
-
assert_equal("http://www.43things.com/things/view/255",
|
169
|
-
goal.link)
|
170
|
-
assert_equal(903, goal.num_registered_people)
|
171
|
-
assert_equal(180, goal.num_unregistered_people)
|
172
|
-
assert_equal(352, goal.num_say_worth_it)
|
173
|
-
assert_equal(21, goal.num_say_not_worth_it)
|
174
|
-
assert_equal(94, goal.percentage_worth_it)
|
175
|
-
assert_equal(["43 things","testing","beta","beta test","blog"], goal.tags)
|
176
|
-
assert_equal("tag:43things.com:goal:255",goal.id)
|
177
|
-
end
|
178
|
-
|
179
|
-
|
180
|
-
def test_search_goals
|
181
|
-
goals = @connection.search_goals("schemer").goals
|
182
|
-
assert_instance_of(Array, goals)
|
183
|
-
assert_equal(1, goals.length)
|
184
|
-
assert_equal("finish reading The Little Schemer", goals[0].name)
|
185
|
-
goals.each do |goal|
|
186
|
-
assert_instance_of(Goal, goal)
|
187
|
-
end
|
188
|
-
goals = @connection.search_goals("ruby", {"offset" => 20, "max" => 10}).goals
|
189
|
-
assert_equal(10, goals.length)
|
190
|
-
assert_equal("Learn to program in Ruby", goals[0].name)
|
191
|
-
goals.each do |goal|
|
192
|
-
assert_instance_of(Goal, goal)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
def test_get_goals_similarities
|
199
|
-
goals = @connection.get_goals_similarities(255).goals
|
200
|
-
assert_instance_of(Array, goals)
|
201
|
-
assert_equal(212,goals[0].goal_id)
|
202
|
-
assert_equal("Make Firefox my default browser",goals[1].name)
|
203
|
-
goals.each do |goal|
|
204
|
-
assert_instance_of(Goal, goal)
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
def test_get_goals_people
|
209
|
-
people = @connection.get_goals_people(533).people
|
210
|
-
assert_instance_of(Array, people)
|
211
|
-
assert_equal(20, people.length)
|
212
|
-
assert_equal("pate", people[0].name)
|
213
|
-
people = @connection.get_goals_people(533,{"offset"=>20}).people
|
214
|
-
assert_equal(5, people.length)
|
215
|
-
assert_equal("Guan Yang", people[0].name)
|
216
|
-
people.each do |person|
|
217
|
-
assert_instance_of(Person, person)
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
def test_get_goals_entries
|
222
|
-
entries = @connection.get_goals_entries(533).entries
|
223
|
-
assert_instance_of(Array, entries)
|
224
|
-
assert_equal(4, entries.length)
|
225
|
-
assert_equal("pate", entries[0].author.name)
|
226
|
-
entries = @connection.get_goals_entries(255, {
|
227
|
-
"offset" => 20,
|
228
|
-
"max" => 10,
|
229
|
-
"view" => "done"
|
230
|
-
}).entries
|
231
|
-
assert_equal(10, entries.length)
|
232
|
-
assert_equal("iflynn",entries[0].author.name)
|
233
|
-
entries.each do |entry|
|
234
|
-
assert_instance_of(Entry, entry)
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
|
239
|
-
def test_get_person
|
240
|
-
person = @connection.get_person("erik")
|
241
|
-
assert_instance_of(Person, person)
|
242
|
-
assert_equal("erik", person.username)
|
243
|
-
assert_equal("Erik Benson", person.name)
|
244
|
-
assert_equal("http://erikbenson.com", person.url)
|
245
|
-
assert_equal("http://images.43things.com/profile/00/00/22/8818s.jpg",person.profile_image_url)
|
246
|
-
assert_equal("http://www.43things.com/people/view/erik",person.link)
|
247
|
-
assert_instance_of(City, person.city)
|
248
|
-
assert_equal(1, person.city.city_id)
|
249
|
-
assert_instance_of(Array, person.goals)
|
250
|
-
person.goals.each do |goal|
|
251
|
-
assert_instance_of(Goal, goal)
|
252
|
-
end
|
253
|
-
assert_equal("tag:43things.com:Erik Benson:goal:44", person.goals[0].id)
|
254
|
-
assert_equal(person.num_open_goals, person.goals.length)
|
255
|
-
|
256
|
-
person2 = @connection.get_person("sweeting")
|
257
|
-
assert_equal("none", person2.profile_image_url)
|
258
|
-
assert_equal(nil,person2.city)
|
259
|
-
|
260
|
-
person3 = @connection.get_person("erikbenson", true)
|
261
|
-
assert_equal("erikbenson",person3.flickr_username)
|
262
|
-
assert_equal(person.username, person3.username)
|
263
|
-
assert_equal(person.name, person3.name)
|
264
|
-
assert_equal(person.url, person3.url)
|
265
|
-
assert_equal(person.profile_image_url, person3.profile_image_url)
|
266
|
-
assert_equal(person.num_open_goals, person3.num_open_goals)
|
267
|
-
assert_equal(person.link, person3.link)
|
268
|
-
assert_equal(person.flickr_username, person3.flickr_username)
|
269
|
-
end
|
270
|
-
|
271
|
-
def test_search_cities
|
272
|
-
cities = @connection.search_cities("london")
|
273
|
-
assert_instance_of(Array, cities)
|
274
|
-
assert_equal(16, cities.length)
|
275
|
-
assert_equal("United Kingdom", cities[0].country)
|
276
|
-
cities.each { |city| assert_instance_of(City, city) }
|
277
|
-
end
|
278
|
-
|
279
|
-
def test_get_city
|
280
|
-
city = @connection.get_city(36)
|
281
|
-
assert_equal("Kent", city.name)
|
282
|
-
assert_equal("Washington", city.region)
|
283
|
-
assert_equal("United States", city.country)
|
284
|
-
assert_equal(6, city.num_people)
|
285
|
-
assert_equal(20, city.goals.length)
|
286
|
-
end
|
287
|
-
|
288
|
-
def test_get_citys_people
|
289
|
-
people = @connection.get_citys_people(1164)
|
290
|
-
assert_instance_of(Array, people)
|
291
|
-
assert_equal("zerokarmaleft", people[5].username)
|
292
|
-
people.each { |person| assert_instance_of(Person, person) }
|
293
|
-
people = @connection.get_citys_people(1164, {
|
294
|
-
"offset" => 20,
|
295
|
-
"max" => 20
|
296
|
-
})
|
297
|
-
assert_equal(1, people.length)
|
298
|
-
assert_equal("JoelBlain", people[0].username)
|
299
|
-
people.each { |person| assert_instance_of(Person, person) }
|
300
|
-
end
|
301
|
-
|
302
|
-
end
|
303
|
-
|
304
|
-
class TestResponse < Test::Unit::TestCase
|
305
|
-
|
306
|
-
def test_more
|
307
|
-
request = FakeRequest.new('1234')
|
308
|
-
response = request.search_goals("ruby")
|
309
|
-
response.more
|
310
|
-
assert_equal(40,response.goals.length)
|
311
|
-
response.goals.each do |goal|
|
312
|
-
assert_instance_of(Goal, goal)
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
end
|
317
|
-
|
318
|
-
class TestGoal < Test::Unit::TestCase
|
319
|
-
def setup
|
320
|
-
@goal_id = 255
|
321
|
-
@name = "Try out 43 Things"
|
322
|
-
@link = "http://www.43things.com/things/view/255"
|
323
|
-
@num_registered_people = 899
|
324
|
-
@num_unregistered_people = 175
|
325
|
-
@num_say_worth_it = 349
|
326
|
-
@num_say_not_worth_it = 21
|
327
|
-
@percentage_worth_it = 94
|
328
|
-
@tags = ["43 things","testing","beta","beta test","blog"]
|
329
|
-
@id = "tag:43things.com:goal:255"
|
330
|
-
@progress_link = "http://www.43things.com/people/progress/erik/59"
|
331
|
-
@team_link = "http://www.43things.com/teams/progress/59"
|
332
|
-
@goal = Goal.new()
|
333
|
-
end
|
334
|
-
|
335
|
-
def test_progress_link
|
336
|
-
assert_nil(@goal.progress_link)
|
337
|
-
end
|
338
|
-
|
339
|
-
def test_progress_link=()
|
340
|
-
@goal.progress_link= @progress_link
|
341
|
-
assert_equal(@progress_link,@goal.progress_link)
|
342
|
-
end
|
343
|
-
|
344
|
-
def test_team_link
|
345
|
-
assert_nil(@goal.team_link)
|
346
|
-
end
|
347
|
-
|
348
|
-
def test_team_link=()
|
349
|
-
@goal.team_link= @team_link
|
350
|
-
assert_equal(@team_link,@goal.team_link)
|
351
|
-
end
|
352
|
-
|
353
|
-
def test_goal_id
|
354
|
-
assert_nil(@goal.goal_id)
|
355
|
-
end
|
356
|
-
|
357
|
-
def test_goal_id
|
358
|
-
@goal.goal_id= @goal_id
|
359
|
-
assert_equal(@goal_id, @goal.goal_id)
|
360
|
-
end
|
361
|
-
|
362
|
-
def test_name
|
363
|
-
assert_equal(nil,@goal.name)
|
364
|
-
end
|
365
|
-
|
366
|
-
def test_name
|
367
|
-
@goal.name= @name
|
368
|
-
assert_equal(@name,@goal.name)
|
369
|
-
end
|
370
|
-
|
371
|
-
def test_link
|
372
|
-
assert_nil(@goal.link)
|
373
|
-
end
|
374
|
-
|
375
|
-
def test_link
|
376
|
-
@goal.link= @link
|
377
|
-
assert_equal(@link, @goal.link)
|
378
|
-
end
|
379
|
-
|
380
|
-
def test_num_registered_people
|
381
|
-
assert_nil(@goal.num_registered_people)
|
382
|
-
end
|
383
|
-
|
384
|
-
def test_num_registered_people=
|
385
|
-
@goal.num_registered_people= @num_registered_people
|
386
|
-
assert_equal(@num_registered_people, @goal.num_registered_people)
|
387
|
-
end
|
388
|
-
|
389
|
-
def test_num_unregistered_people
|
390
|
-
assert_nil(@goal.num_unregistered_people)
|
391
|
-
end
|
392
|
-
|
393
|
-
def test_num_unregistered_people=
|
394
|
-
@goal.num_unregistered_people= @num_unregistered_people
|
395
|
-
assert_equal(@num_unregistered_people, @goal.num_unregistered_people)
|
396
|
-
end
|
397
|
-
|
398
|
-
def test_num_say_worth_it
|
399
|
-
assert_nil(@goal.num_say_worth_it)
|
400
|
-
end
|
401
|
-
|
402
|
-
def test_num_say_worth_it=
|
403
|
-
@goal.num_say_worth_it= @num_say_worth_it
|
404
|
-
assert_equal(@num_say_worth_it, @goal.num_say_worth_it)
|
405
|
-
end
|
406
|
-
|
407
|
-
def test_num_say_not_worth_it
|
408
|
-
assert_nil(@goal.num_say_not_worth_it)
|
409
|
-
end
|
410
|
-
|
411
|
-
def test_num_say_not_worth_it=
|
412
|
-
@goal.num_say_not_worth_it= @num_say_not_worth_it
|
413
|
-
assert_equal(@num_say_not_worth_it, @goal.num_say_not_worth_it)
|
414
|
-
end
|
415
|
-
|
416
|
-
def test_percentage_worth_it
|
417
|
-
assert_nil(@goal.percentage_worth_it)
|
418
|
-
end
|
419
|
-
|
420
|
-
def test_percentage_worth_it=
|
421
|
-
@goal.percentage_worth_it= @percentage_worth_it
|
422
|
-
assert_equal(@percentage_worth_it, @goal.percentage_worth_it)
|
423
|
-
end
|
424
|
-
|
425
|
-
def test_tags
|
426
|
-
assert_equal(nil,@goal.tags)
|
427
|
-
end
|
428
|
-
|
429
|
-
def test_tags
|
430
|
-
@goal.tags= @tags
|
431
|
-
assert_instance_of(Array, @goal.tags)
|
432
|
-
assert_equal(@tags,@goal.tags)
|
433
|
-
end
|
434
|
-
|
435
|
-
def test_id
|
436
|
-
assert_equal(nil,@goal.id)
|
437
|
-
end
|
438
|
-
|
439
|
-
def test_id=
|
440
|
-
@goal.id= @id
|
441
|
-
assert_equal(@id,@goal.id)
|
442
|
-
end
|
443
|
-
|
444
|
-
end
|
445
|
-
|
446
|
-
|
447
|
-
class TestPerson < Test::Unit::TestCase
|
448
|
-
def setup
|
449
|
-
@username = "erik"
|
450
|
-
@name = "Erik Benson"
|
451
|
-
@url = "http://erikbenson.com"
|
452
|
-
@profile_image_url = "http://www.43things.com/profile/00/00/17/6124s.jpg"
|
453
|
-
@num_open_goals = 32
|
454
|
-
@link = "http://www.43things.com/people/view/erik"
|
455
|
-
@city = [
|
456
|
-
"Seattle","Washington","United States",
|
457
|
-
236, "http://www.43things.com/city/view/1"]
|
458
|
-
goal1 = Goal.new()
|
459
|
-
@goals = [goal1]
|
460
|
-
@testPerson = Person.new()
|
461
|
-
end
|
462
|
-
|
463
|
-
def test_city
|
464
|
-
assert_nil(@testPerson.city)
|
465
|
-
end
|
466
|
-
|
467
|
-
def test_city=
|
468
|
-
@testPerson.city= @city
|
469
|
-
assert_equal(@city, @testPerson.city)
|
470
|
-
end
|
471
|
-
|
472
|
-
def test_goals
|
473
|
-
assert_nil(@testPerson.goals)
|
474
|
-
end
|
475
|
-
|
476
|
-
def test_goals=
|
477
|
-
@testPerson.goals= @goals
|
478
|
-
assert_equal(@goals, @testPerson.goals)
|
479
|
-
end
|
480
|
-
|
481
|
-
def test_profile_image_url
|
482
|
-
assert_nil(@testPerson.profile_image_url)
|
483
|
-
end
|
484
|
-
|
485
|
-
def test_profile_image_url=
|
486
|
-
@testPerson.profile_image_url= @profile_image_url
|
487
|
-
assert_equal(@profile_image_url, @testPerson.profile_image_url)
|
488
|
-
end
|
489
|
-
|
490
|
-
def test_link
|
491
|
-
assert_nil(@testPerson.link)
|
492
|
-
end
|
493
|
-
|
494
|
-
def test_link=
|
495
|
-
@testPerson.link= @link
|
496
|
-
assert_equal(@link, @testPerson.link)
|
497
|
-
end
|
498
|
-
|
499
|
-
def test_num_open_goals
|
500
|
-
assert_nil(@testPerson.num_open_goals)
|
501
|
-
end
|
502
|
-
|
503
|
-
def test_num_open_goals=
|
504
|
-
@testPerson.num_open_goals= @num_open_goals
|
505
|
-
assert_equal(@num_open_goals, @testPerson.num_open_goals)
|
506
|
-
end
|
507
|
-
|
508
|
-
def test_url
|
509
|
-
assert_nil(@testPerson.url)
|
510
|
-
end
|
511
|
-
|
512
|
-
def test_url=
|
513
|
-
@testPerson.url= @url
|
514
|
-
assert_equal(@url, @testPerson.url)
|
515
|
-
end
|
516
|
-
|
517
|
-
def test_username
|
518
|
-
assert_nil(@testPerson.username)
|
519
|
-
end
|
520
|
-
|
521
|
-
def test_username
|
522
|
-
@testPerson.username= @username
|
523
|
-
assert_equal(@username, @testPerson.username)
|
524
|
-
end
|
525
|
-
|
526
|
-
end
|
527
|
-
|
528
|
-
|
529
|
-
class TestEntry < Test::Unit::TestCase
|
530
|
-
|
531
|
-
def setup
|
532
|
-
@title = "Started - September 2004"
|
533
|
-
@author = {
|
534
|
-
"name" => "Josh Petersen",
|
535
|
-
"username" => "joshp",
|
536
|
-
"url" => "http://joshp.typepad.com",
|
537
|
-
"num_open_goals" => 41,
|
538
|
-
"link" => "http://www.43things.com/people/view/joshp"
|
539
|
-
}
|
540
|
-
@dc_subject = "start a company that survives longer than 2 years"
|
541
|
-
@goal = {
|
542
|
-
"goal_id" => 9,
|
543
|
-
"name" => "Start a company that survives longer than 2 years",
|
544
|
-
"link" => "http://www.43things.com/things/view/9",
|
545
|
-
"num_registered_people" => 162,
|
546
|
-
"num_unregistered_people" => 16,
|
547
|
-
"id" => "tag:43things.com:goal:9"
|
548
|
-
}
|
549
|
-
@content = "It's odd to say that the objective is survival rather than huge market success. But just making it work and sticking to it is the objective I'm after. Hopefully, by making sure the product we develop is meaningful and the work set-up is friendly and fun, drudgery will be held in abeyance and the world will be positively impacted by what we do.
|
550
|
-
|
551
|
-
Anyway, about 2-3 times a day I'm struck with some paranoid thought or shuddering fear about making sure the company is still here in 2-3 years. It's like an internal emotional tide. Here comes the wave of utter terror! There goes the tide of dread and its a cresting wave of happiness again."
|
552
|
-
@num_comments = 1
|
553
|
-
@issued = "2004-12-02T00:43:50Z"
|
554
|
-
@link = "http://www.43things.com/entries/view/33"
|
555
|
-
@id = "tag:43things.com:joshp:entry:33"
|
556
|
-
|
557
|
-
@entry = Entry.new()
|
558
|
-
end
|
559
|
-
|
560
|
-
def test_title
|
561
|
-
assert_nil(@entry.title)
|
562
|
-
end
|
563
|
-
|
564
|
-
def test_title=
|
565
|
-
@entry.title=@title
|
566
|
-
assert_equal(@title, @entry.title)
|
567
|
-
end
|
568
|
-
|
569
|
-
def test_author
|
570
|
-
assert_nil(@entry.author)
|
571
|
-
end
|
572
|
-
|
573
|
-
def test_author=
|
574
|
-
@entry.author=@author
|
575
|
-
assert_equal(@author, @entry.author)
|
576
|
-
end
|
577
|
-
|
578
|
-
def test_dc_subject
|
579
|
-
assert_nil(@entry.dc_subject)
|
580
|
-
end
|
581
|
-
|
582
|
-
def test_dc_subject=
|
583
|
-
@entry.dc_subject=@dc_subject
|
584
|
-
assert_equal(@dc_subject, @entry.dc_subject)
|
585
|
-
end
|
586
|
-
|
587
|
-
def test_goal
|
588
|
-
assert_nil(@entry.goal)
|
589
|
-
end
|
590
|
-
|
591
|
-
def test_goal=
|
592
|
-
@entry.goal=@goal
|
593
|
-
assert_equal(@goal, @entry.goal)
|
594
|
-
end
|
595
|
-
|
596
|
-
def test_content
|
597
|
-
assert_nil(@entry.content)
|
598
|
-
end
|
599
|
-
|
600
|
-
def test_content=
|
601
|
-
@entry.content=@content
|
602
|
-
assert_equal(@content, @entry.content)
|
603
|
-
end
|
604
|
-
|
605
|
-
def test_num_comments
|
606
|
-
assert_nil(@entry.num_comments)
|
607
|
-
end
|
608
|
-
|
609
|
-
def test_num_comments=
|
610
|
-
@entry.num_comments=@num_comments
|
611
|
-
assert_equal(@num_comments, @entry.num_comments)
|
612
|
-
end
|
613
|
-
|
614
|
-
def test_issued
|
615
|
-
assert_nil(@entry.issued)
|
616
|
-
end
|
617
|
-
|
618
|
-
def test_issued=
|
619
|
-
@entry.issued=@issued
|
620
|
-
assert_equal(@issued, @entry.issued)
|
621
|
-
end
|
622
|
-
|
623
|
-
def test_link
|
624
|
-
assert_nil(@entry.link)
|
625
|
-
end
|
626
|
-
|
627
|
-
def test_link=
|
628
|
-
@entry.link=@link
|
629
|
-
assert_equal(@link, @entry.link)
|
630
|
-
end
|
631
|
-
|
632
|
-
def test_id
|
633
|
-
assert_nil(@entry.id)
|
634
|
-
end
|
635
|
-
|
636
|
-
def test_id=
|
637
|
-
@entry.id=@id
|
638
|
-
assert_equal(@id, @entry.id)
|
639
|
-
end
|
640
|
-
|
641
|
-
end
|
642
|
-
|
643
|
-
|
644
|
-
class TestCity < Test::Unit::TestCase
|
645
|
-
def setup
|
646
|
-
@city_id = 36
|
647
|
-
@name = 'Kent'
|
648
|
-
@region = 'Washington'
|
649
|
-
@country = 'USA'
|
650
|
-
@num_people = 2
|
651
|
-
@link = "http://www.43things.com/city/view/36"
|
652
|
-
goal1 = Goal.new
|
653
|
-
@goals = [goal1]
|
654
|
-
@city = City.new
|
655
|
-
end
|
656
|
-
|
657
|
-
def test_new
|
658
|
-
assert_instance_of(City, @city)
|
659
|
-
end
|
660
|
-
|
661
|
-
def test_name
|
662
|
-
assert_nil(@city.name)
|
663
|
-
end
|
664
|
-
|
665
|
-
def test_name=()
|
666
|
-
@city.name= @name
|
667
|
-
assert_equal(@name, @city.name)
|
668
|
-
end
|
669
|
-
|
670
|
-
def test_city_id
|
671
|
-
assert_nil(@city.city_id)
|
672
|
-
end
|
673
|
-
|
674
|
-
def test_city_id=()
|
675
|
-
@city.city_id= @city_id
|
676
|
-
assert_equal(@city_id, @city.city_id
|
677
|
-
)
|
678
|
-
end
|
679
|
-
|
680
|
-
def test_region
|
681
|
-
assert_nil(@city.region)
|
682
|
-
end
|
683
|
-
|
684
|
-
def test_region=()
|
685
|
-
@city.region= @region
|
686
|
-
assert_equal(@region, @city.region)
|
687
|
-
end
|
688
|
-
|
689
|
-
def test_country
|
690
|
-
assert_nil(@city.country)
|
691
|
-
end
|
692
|
-
|
693
|
-
def test_country=()
|
694
|
-
@city.country= @country
|
695
|
-
assert_equal(@country, @city.country)
|
696
|
-
end
|
697
|
-
|
698
|
-
def test_num_people
|
699
|
-
assert_nil(@city.num_people)
|
700
|
-
end
|
701
|
-
|
702
|
-
def test_num_people=()
|
703
|
-
@city.num_people= @num_people
|
704
|
-
assert_equal(@num_people, @city.num_people)
|
705
|
-
end
|
706
|
-
|
707
|
-
def test_link
|
708
|
-
assert_nil(@city.link)
|
709
|
-
end
|
710
|
-
|
711
|
-
def test_link=()
|
712
|
-
@city.link= @link
|
713
|
-
assert_equal(@link, @city.link)
|
714
|
-
end
|
715
|
-
|
716
|
-
def test_goals
|
717
|
-
assert_nil(@city.goals)
|
718
|
-
end
|
719
|
-
|
720
|
-
def test_goals=()
|
721
|
-
@city.goals= @goals
|
722
|
-
assert_equal(@goals, @city.goals)
|
723
|
-
end
|
724
|
-
|
725
|
-
|
726
|
-
end
|
727
|
-
|
728
|
-
|