plancast 0.0.2 → 0.1.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.
@@ -1,128 +0,0 @@
1
- require 'helper'
2
-
3
- class TestPlancast < Test::Unit::TestCase
4
- context "When using the UNDOCUMENTED Plancast API" do
5
- setup do
6
- @client = Plancast::Client.new('pengwynn', 'password')
7
- end
8
-
9
- should "verify credentials" do
10
- stub_get("/account/verify_credentials.json", "verify_credentials.json")
11
- lambda {@client.verify_credentials}.should_not raise_error
12
- end
13
-
14
- should "return user info when verifying credentials" do
15
- stub_get("/account/verify_credentials.json", "verify_credentials.json")
16
- user = @client.verify_credentials
17
- user.screen_name.should == 'pengwynn'
18
- user.user.status.attendees.first.screen_name.should == 'damon'
19
- end
20
-
21
- should "raise error on invalid credentials" do
22
- stub_get("/account/verify_credentials.json", "", ['401'])
23
- lambda {@client.verify_credentials}.should raise_error(Plancast::Unauthorized)
24
- end
25
-
26
- should "return the home timeline" do
27
- stub_get("/plans/home_timeline.json", "home_timeline.json")
28
- timeline = @client.home_timeline
29
- timeline.plans.size.should == 25
30
- timeline.plans.first.plan_id.should == 'c9f'
31
- timeline.plans.first.user.screen_name.should == 'davemcclure'
32
- end
33
-
34
- should "return the user timeline for the authenticated user" do
35
- stub_get("/plans/user_timeline.json", "user_timeline.json")
36
- timeline = @client.user_timeline
37
- timeline.plans.first.what.should == 'Create a Plancast wrapper when the API drops'
38
- #timeline.plans.first.start.should == Time.at(1269302400)
39
- end
40
-
41
- should "create a plan" do
42
- stub_post("/plans/update.json", "update.json")
43
- details = {
44
- :what => "OpenBeta4",
45
- :when => "Thursday",
46
- :where => "723 n hudson, 73120",
47
- :syndicate_twitter => 1
48
- }
49
- plan = @client.update(details)
50
- plan.plan_id.should == 'utn'
51
- plan.is_attending?.should == true
52
- end
53
-
54
- should "attend a plan" do
55
- stub_post("/plans/attend.json?plan_id=u6i", "attend.json")
56
- plan = @client.attend('u6i')
57
- plan.attendance_id.should == '23rk'
58
- plan.what.should == 'Android Developer Day'
59
- end
60
-
61
- should "unattend a plan" do
62
- stub_post("/plans/destroy.json?attendance_id=23rl", "unattend.json")
63
- plan = @client.unattend('23rl')
64
- plan.attendance_id.should == '23rl'
65
- plan.plan_id.should == '2n7'
66
- end
67
-
68
- should "show plan details" do
69
- stub_get("/plans/show.json?attendance_id=mkg", "plan.json")
70
- plan = @client.plan('mkg')
71
- plan.attendance_id.should == 'mkg'
72
- plan.plan_id.should == 'c9f'
73
- end
74
-
75
- should "search for plans" do
76
- stub_get("/plans/search.json?q=bradleyjoyce", "search.json")
77
- results = @client.search_plans('bradleyjoyce').results
78
- results.first.plan_id.should == "1"
79
- results.first.what.should == 'Drinks'
80
- end
81
-
82
- should "show user details" do
83
- stub_get("/users/show.json?screen_name=mark", "user.json")
84
- user = @client.user('mark')
85
- user.name.should == 'Mark Hendrickson'
86
- user.has_twitter?.should == true
87
- end
88
-
89
- should"search for users" do
90
- stub_get("/users/search.json?q=bradleyjoyce", "user_search.json")
91
- results = @client.search_users('bradleyjoyce').results
92
- results.first.screen_name.should == "bradleyjoyce"
93
- end
94
-
95
- should "create a friendship" do
96
- stub_post("/friendships/create.json", "create_friendship.json")
97
- user = @client.create_friendship(35)
98
- user.screen_name.should == "defunkt"
99
- end
100
-
101
- should "list subscriptions" do
102
- stub_get("/users/subscriptions.json?user_id=30", "subscriptions.json")
103
- subscriptions = @client.subscriptions(30)
104
- subscriptions.size.should == 25
105
- subscriptions.first.screen_name = 'soph'
106
- end
107
-
108
- should "list subscribers" do
109
- stub_get("/users/subscribers.json?user_id=30", "subscribers.json")
110
- subscribers = @client.subscribers(30)
111
- subscribers.size.should == 25
112
- subscribers.first.screen_name = 'mark'
113
- end
114
-
115
- should "create comments" do
116
- stub_post("/comments/update.json", "comment.json")
117
- info = {
118
- :plan_id => 1,
119
- :text => "This is a comment"
120
- }
121
- comment = @client.create_comment(info)
122
- comment.text.should == 'This is a comment'
123
- comment.user.screen_name.should == 'pengwynn'
124
- end
125
-
126
- end
127
-
128
- end