koala 0.10.0 → 1.0.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/.gitignore +3 -0
- data/CHANGELOG +37 -7
- data/Gemfile +3 -0
- data/LICENSE +1 -1
- data/Manifest +8 -1
- data/Rakefile +13 -14
- data/koala.gemspec +36 -19
- data/lib/koala/graph_api.rb +188 -123
- data/lib/koala/http_services.rb +93 -18
- data/lib/koala/rest_api.rb +73 -6
- data/lib/koala/test_users.rb +21 -8
- data/lib/koala/uploadable_io.rb +115 -0
- data/lib/koala.rb +104 -120
- data/readme.md +29 -16
- data/spec/cases/api_base_spec.rb +101 -0
- data/spec/cases/graph_and_rest_api_spec.rb +31 -0
- data/spec/cases/graph_api_spec.rb +25 -0
- data/spec/cases/http_services/http_service_spec.rb +54 -0
- data/spec/cases/http_services/net_http_service_spec.rb +350 -0
- data/spec/cases/http_services/typhoeus_service_spec.rb +144 -0
- data/spec/cases/oauth_spec.rb +409 -0
- data/spec/cases/realtime_updates_spec.rb +184 -0
- data/spec/cases/rest_api_spec.rb +25 -0
- data/spec/{koala/test_users/test_users_tests.rb → cases/test_users_spec.rb} +78 -72
- data/spec/cases/uploadable_io_spec.rb +151 -0
- data/spec/fixtures/beach.jpg +0 -0
- data/spec/{facebook_data.yml → fixtures/facebook_data.yml} +13 -9
- data/spec/{mock_facebook_responses.yml → fixtures/mock_facebook_responses.yml} +314 -289
- data/spec/spec_helper.rb +18 -0
- data/spec/support/graph_api_shared_examples.rb +424 -0
- data/spec/{koala → support}/live_testing_data_helper.rb +39 -42
- data/spec/{mock_http_service.rb → support/mock_http_service.rb} +94 -81
- data/spec/support/rest_api_shared_examples.rb +161 -0
- data/spec/support/setup_mocks_or_live.rb +52 -0
- data/spec/support/uploadable_io_shared_examples.rb +76 -0
- metadata +127 -43
- data/init.rb +0 -2
- data/spec/koala/api_base_tests.rb +0 -102
- data/spec/koala/graph_and_rest_api/graph_and_rest_api_no_token_tests.rb +0 -10
- data/spec/koala/graph_and_rest_api/graph_and_rest_api_with_token_tests.rb +0 -11
- data/spec/koala/graph_api/graph_api_no_access_token_tests.rb +0 -114
- data/spec/koala/graph_api/graph_api_with_access_token_tests.rb +0 -150
- data/spec/koala/graph_api/graph_collection_tests.rb +0 -104
- data/spec/koala/net_http_service_tests.rb +0 -186
- data/spec/koala/oauth/oauth_tests.rb +0 -438
- data/spec/koala/realtime_updates/realtime_updates_tests.rb +0 -187
- data/spec/koala/rest_api/rest_api_no_access_token_tests.rb +0 -94
- data/spec/koala/rest_api/rest_api_with_access_token_tests.rb +0 -36
- data/spec/koala_spec.rb +0 -18
- data/spec/koala_spec_helper.rb +0 -48
- data/spec/koala_spec_without_mocks.rb +0 -19
|
@@ -1,289 +1,314 @@
|
|
|
1
|
-
# Responses by MockHTTPService are taken directly from
|
|
2
|
-
# this file.
|
|
3
|
-
#
|
|
4
|
-
# Structure
|
|
5
|
-
# ----------
|
|
6
|
-
#
|
|
7
|
-
# path:
|
|
8
|
-
# arguments: # sorted by key
|
|
9
|
-
# method: # HTTP method (GET, POST, DELETE, etc.)
|
|
10
|
-
# with_token:
|
|
11
|
-
# no_token:
|
|
12
|
-
|
|
13
|
-
# ====== REST API =====
|
|
14
|
-
rest_api:
|
|
15
|
-
|
|
16
|
-
# -- Stubbed Responses --
|
|
17
|
-
/method/fql.query:
|
|
18
|
-
query=select first_name from user where uid = 216743:
|
|
19
|
-
get:
|
|
20
|
-
no_token: '[{"first_name":"Chris"}]'
|
|
21
|
-
with_token: '[{"first_name":"Chris"}]'
|
|
22
|
-
query=select read_stream from permissions where uid = 216743:
|
|
23
|
-
get:
|
|
24
|
-
with_token: '[{"read_stream":1}]'
|
|
25
|
-
no_token: '{"error_code":104,"error_msg":"Requires valid signature","request_args":[{"key":"method","value":"fql.query"},{"key":"format","value":"json"},{"key":"query","value":"select read_stream from permissions where uid = 216743"}]}'
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# ====== GRAPH API =====
|
|
29
|
-
graph_api:
|
|
30
|
-
|
|
31
|
-
# -- Common Responses --
|
|
32
|
-
|
|
33
|
-
# Error responses for when a token is required, but not given
|
|
34
|
-
token_required_responses: &token_required
|
|
35
|
-
no_token: '{"error":{"type":"OAuthAccessTokenException", "message":"An access token is required to request this resource."}}'
|
|
36
|
-
|
|
37
|
-
# Common mock item responses
|
|
38
|
-
item_deleted: &item_deleted
|
|
39
|
-
delete:
|
|
40
|
-
with_token: 'true'
|
|
41
|
-
|
|
42
|
-
# OAuth error response
|
|
43
|
-
oauth_error: &oauth_error
|
|
44
|
-
no_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
|
45
|
-
|
|
46
|
-
# Subscription error response
|
|
47
|
-
verification_error: &verification_error
|
|
48
|
-
with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
|
49
|
-
|
|
50
|
-
test_user_no_perms: &test_user_no_perms
|
|
51
|
-
post:
|
|
52
|
-
with_token: '{"id": "777777777", "access_token":"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
get:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/
|
|
99
|
-
no_args:
|
|
100
|
-
get:
|
|
101
|
-
with_token: '{"
|
|
102
|
-
no_token: '{"
|
|
103
|
-
|
|
104
|
-
/
|
|
105
|
-
no_args:
|
|
106
|
-
get:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
/
|
|
111
|
-
no_args:
|
|
112
|
-
get:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
post:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
object=
|
|
195
|
-
|
|
196
|
-
with_token:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
/
|
|
226
|
-
no_args:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
with_token:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
with_token: '
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
1
|
+
# Responses by MockHTTPService are taken directly from
|
|
2
|
+
# this file.
|
|
3
|
+
#
|
|
4
|
+
# Structure
|
|
5
|
+
# ----------
|
|
6
|
+
#
|
|
7
|
+
# path:
|
|
8
|
+
# arguments: # sorted by key
|
|
9
|
+
# method: # HTTP method (GET, POST, DELETE, etc.)
|
|
10
|
+
# with_token:
|
|
11
|
+
# no_token:
|
|
12
|
+
|
|
13
|
+
# ====== REST API =====
|
|
14
|
+
rest_api:
|
|
15
|
+
|
|
16
|
+
# -- Stubbed Responses --
|
|
17
|
+
/method/fql.query:
|
|
18
|
+
query=select first_name from user where uid = 216743:
|
|
19
|
+
get:
|
|
20
|
+
no_token: '[{"first_name":"Chris"}]'
|
|
21
|
+
with_token: '[{"first_name":"Chris"}]'
|
|
22
|
+
query=select read_stream from permissions where uid = 216743:
|
|
23
|
+
get:
|
|
24
|
+
with_token: '[{"read_stream":1}]'
|
|
25
|
+
no_token: '{"error_code":104,"error_msg":"Requires valid signature","request_args":[{"key":"method","value":"fql.query"},{"key":"format","value":"json"},{"key":"query","value":"select read_stream from permissions where uid = 216743"}]}'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# ====== GRAPH API =====
|
|
29
|
+
graph_api:
|
|
30
|
+
|
|
31
|
+
# -- Common Responses --
|
|
32
|
+
|
|
33
|
+
# Error responses for when a token is required, but not given
|
|
34
|
+
token_required_responses: &token_required
|
|
35
|
+
no_token: '{"error":{"type":"OAuthAccessTokenException", "message":"An access token is required to request this resource."}}'
|
|
36
|
+
|
|
37
|
+
# Common mock item responses
|
|
38
|
+
item_deleted: &item_deleted
|
|
39
|
+
delete:
|
|
40
|
+
with_token: 'true'
|
|
41
|
+
|
|
42
|
+
# OAuth error response
|
|
43
|
+
oauth_error: &oauth_error
|
|
44
|
+
no_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
|
45
|
+
|
|
46
|
+
# Subscription error response
|
|
47
|
+
verification_error: &verification_error
|
|
48
|
+
with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
|
49
|
+
|
|
50
|
+
test_user_no_perms: &test_user_no_perms
|
|
51
|
+
post:
|
|
52
|
+
with_token: '{"id": "777777777", "access_token":"<%= ACCESS_TOKEN %>", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
|
53
|
+
|
|
54
|
+
test_user_befriended: &test_user_befriended
|
|
55
|
+
post:
|
|
56
|
+
with_token: 'true'
|
|
57
|
+
|
|
58
|
+
# -- Stubbed Responses --
|
|
59
|
+
root:
|
|
60
|
+
ids=contextoptional,naitik:
|
|
61
|
+
get:
|
|
62
|
+
with_token: '[{}, {}]'
|
|
63
|
+
no_token: '[{}, {}]'
|
|
64
|
+
/me:
|
|
65
|
+
no_args:
|
|
66
|
+
get:
|
|
67
|
+
<<: *token_required
|
|
68
|
+
with_token: '{"updated_time": 1}'
|
|
69
|
+
fields=id:
|
|
70
|
+
get:
|
|
71
|
+
with_token: '{"id": "216743"}'
|
|
72
|
+
|
|
73
|
+
/me/feed:
|
|
74
|
+
message=Hello, world, from the test suite!:
|
|
75
|
+
post:
|
|
76
|
+
with_token: '{"id": "MOCK_FEED_ITEM"}'
|
|
77
|
+
message=Hello, world, from the test suite, testing comments!:
|
|
78
|
+
post:
|
|
79
|
+
with_token: '{"id": "MOCK_FEED_ITEM"}'
|
|
80
|
+
message=the cats are asleep:
|
|
81
|
+
post:
|
|
82
|
+
with_token: '{"id": "FEED_ITEM_CATS"}'
|
|
83
|
+
message=Hello, world, from the test suite delete method!:
|
|
84
|
+
post:
|
|
85
|
+
with_token: '{"id": "FEED_ITEM_DELETE"}'
|
|
86
|
+
link=http://oauth.twoalex.com/&message=Hello, world, from the test suite again!&name=OAuth Playground:
|
|
87
|
+
post:
|
|
88
|
+
with_token: '{"id": "FEED_ITEM_CONTEXT"}'
|
|
89
|
+
/me/photos:
|
|
90
|
+
source=[FILE]:
|
|
91
|
+
post:
|
|
92
|
+
<<: *token_required
|
|
93
|
+
with_token: '{"id": "MOCK_PHOTO"}'
|
|
94
|
+
message=This is the test message&source=[FILE]:
|
|
95
|
+
post:
|
|
96
|
+
<<: *token_required
|
|
97
|
+
with_token: '{"id": "MOCK_PHOTO"}'
|
|
98
|
+
/koppel:
|
|
99
|
+
no_args:
|
|
100
|
+
get:
|
|
101
|
+
with_token: '{"id": 1, "name": 1, "updated_time": 1}'
|
|
102
|
+
no_token: '{"id": 1, "name": 1}'
|
|
103
|
+
|
|
104
|
+
/contextoptional:
|
|
105
|
+
no_args:
|
|
106
|
+
get:
|
|
107
|
+
with_token: '{"id": 1, "name": 1}'
|
|
108
|
+
no_token: '{"id": 1, "name": 1}'
|
|
109
|
+
|
|
110
|
+
/contextoptional/photos:
|
|
111
|
+
no_args:
|
|
112
|
+
get:
|
|
113
|
+
with_token: '{"data": [{}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
|
114
|
+
no_token: '{"data": [{}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
|
115
|
+
|
|
116
|
+
/lukeshepard/likes:
|
|
117
|
+
no_args:
|
|
118
|
+
get:
|
|
119
|
+
<<: *token_required
|
|
120
|
+
with_token: '{"data": [{}]}'
|
|
121
|
+
|
|
122
|
+
/lukeshepard/picture:
|
|
123
|
+
type=large:
|
|
124
|
+
get:
|
|
125
|
+
no_token:
|
|
126
|
+
code: 302
|
|
127
|
+
headers:
|
|
128
|
+
Location: https://facebook.com/large
|
|
129
|
+
with_token:
|
|
130
|
+
code: 302
|
|
131
|
+
headers:
|
|
132
|
+
Location: https://facebook.com/large
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
/chris.baclig/picture:
|
|
136
|
+
no_args:
|
|
137
|
+
get:
|
|
138
|
+
no_token:
|
|
139
|
+
code: 302
|
|
140
|
+
headers:
|
|
141
|
+
Location: http://facebook.com/
|
|
142
|
+
with_token:
|
|
143
|
+
code: 302
|
|
144
|
+
headers:
|
|
145
|
+
Location: http://facebook.com/
|
|
146
|
+
|
|
147
|
+
/search:
|
|
148
|
+
q=facebook:
|
|
149
|
+
get:
|
|
150
|
+
with_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
|
151
|
+
no_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
|
152
|
+
"limit=25&q=facebook&until=2010-09-23T21:17:33+0000":
|
|
153
|
+
get:
|
|
154
|
+
with_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
|
155
|
+
no_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
|
156
|
+
|
|
157
|
+
'/115349521819193_113815981982767':
|
|
158
|
+
no_args:
|
|
159
|
+
delete:
|
|
160
|
+
<<: *token_required
|
|
161
|
+
|
|
162
|
+
# -- OAuth responses --
|
|
163
|
+
/oauth/access_token:
|
|
164
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=<%= OAUTH_CODE %>&redirect_uri=<%= OAUTH_DATA["callback_url"] %>:
|
|
165
|
+
get:
|
|
166
|
+
no_token: access_token=<%= ACCESS_TOKEN %>
|
|
167
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=foo&redirect_uri=<%= OAUTH_DATA["callback_url"] %>:
|
|
168
|
+
get:
|
|
169
|
+
<<: *oauth_error
|
|
170
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&type=client_cred:
|
|
171
|
+
post:
|
|
172
|
+
no_token: access_token=<%= ACCESS_TOKEN %>
|
|
173
|
+
/oauth/exchange_sessions:
|
|
174
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["session_key"] %>&type=client_cred:
|
|
175
|
+
post:
|
|
176
|
+
no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
|
177
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["multiple_session_keys"].join(",") %>&type=client_cred:
|
|
178
|
+
post:
|
|
179
|
+
no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
|
180
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= ["foo"].concat(OAUTH_DATA["multiple_session_keys"]).join(",") %>&type=client_cred:
|
|
181
|
+
post:
|
|
182
|
+
no_token: '[null, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
|
183
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo,bar&type=client_cred:
|
|
184
|
+
post:
|
|
185
|
+
no_token: '[null, null]'
|
|
186
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo&type=client_cred:
|
|
187
|
+
post:
|
|
188
|
+
no_token: '[null]'
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# -- Subscription Responses --
|
|
193
|
+
/<%= APP_ID %>/subscriptions:
|
|
194
|
+
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
|
195
|
+
post:
|
|
196
|
+
with_token:
|
|
197
|
+
code: 200
|
|
198
|
+
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>foo&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
|
199
|
+
post:
|
|
200
|
+
with_token: '{"error":{"type":"Exception","message":"(#2200) subscription validation failed"}}'
|
|
201
|
+
callback_url=foo&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
|
202
|
+
post:
|
|
203
|
+
with_token: '{"error":{"type":"Exception","message":"(#100) callback_url URL is not properly formatted"}}'
|
|
204
|
+
object=user:
|
|
205
|
+
delete:
|
|
206
|
+
with_token:
|
|
207
|
+
code: 200
|
|
208
|
+
object=kittens:
|
|
209
|
+
delete:
|
|
210
|
+
with_token: '{"error":{"type":"Exception","message":"(#100) Invalid parameter"}}'
|
|
211
|
+
no_args:
|
|
212
|
+
delete:
|
|
213
|
+
with_token:
|
|
214
|
+
code: 200
|
|
215
|
+
get:
|
|
216
|
+
with_token: '{"data":[{"callback_url":"http://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}'
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>:
|
|
220
|
+
get:
|
|
221
|
+
with_token: '{"data":[{"callback_url":"http://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}'
|
|
222
|
+
|
|
223
|
+
# -- Mock Item Responses --
|
|
224
|
+
|
|
225
|
+
/MOCK_FEED_ITEM/likes:
|
|
226
|
+
no_args:
|
|
227
|
+
post:
|
|
228
|
+
with_token: '{"id": "MOCK_LIKE"}'
|
|
229
|
+
|
|
230
|
+
/MOCK_FEED_ITEM/comments:
|
|
231
|
+
message=it's my comment!:
|
|
232
|
+
post:
|
|
233
|
+
with_token: '{"id": "MOCK_COMMENT"}'
|
|
234
|
+
|
|
235
|
+
/MOCK_FEED_ITEM:
|
|
236
|
+
no_args:
|
|
237
|
+
<<: *item_deleted
|
|
238
|
+
|
|
239
|
+
/FEED_ITEM_CONTEXT:
|
|
240
|
+
no_args:
|
|
241
|
+
<<: *item_deleted
|
|
242
|
+
get:
|
|
243
|
+
with_token: '{"link":"http://oauth.twoalex.com/", "name": "OAuth Playground"}'
|
|
244
|
+
|
|
245
|
+
/FEED_ITEM_CATS:
|
|
246
|
+
no_args:
|
|
247
|
+
<<: *item_deleted
|
|
248
|
+
get:
|
|
249
|
+
with_token: '{"message": "the cats are asleep"}'
|
|
250
|
+
|
|
251
|
+
/FEED_ITEM_DELETE:
|
|
252
|
+
no_args:
|
|
253
|
+
<<: *item_deleted
|
|
254
|
+
|
|
255
|
+
/FEED_ITEM_DELETE/likes:
|
|
256
|
+
no_args:
|
|
257
|
+
<<: *item_deleted
|
|
258
|
+
post:
|
|
259
|
+
with_token: 'true'
|
|
260
|
+
|
|
261
|
+
/MOCK_COMMENT:
|
|
262
|
+
no_args:
|
|
263
|
+
<<: *item_deleted
|
|
264
|
+
get:
|
|
265
|
+
with_token: "{\"message\": \"it's my comment!\"}"
|
|
266
|
+
/MOCK_PHOTO:
|
|
267
|
+
no_args:
|
|
268
|
+
<<: *item_deleted
|
|
269
|
+
get:
|
|
270
|
+
with_token: "{\"name\": \"This is the test message\"}"
|
|
271
|
+
|
|
272
|
+
# -- Mock Test User Responses --
|
|
273
|
+
/<%= APP_ID %>/accounts/test-users:
|
|
274
|
+
installed=false:
|
|
275
|
+
<<: *test_user_no_perms
|
|
276
|
+
installed=false&permissions=read_stream:
|
|
277
|
+
<<: *test_user_no_perms
|
|
278
|
+
installed=true&permissions=read_stream:
|
|
279
|
+
post:
|
|
280
|
+
with_token: '{"id": "999999999", "access_token":"<%= ACCESS_TOKEN %>", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
|
281
|
+
installed=true&permissions=read_stream,user_interests:
|
|
282
|
+
post:
|
|
283
|
+
with_token: '{"id": "888888888", "access_token":"<%= ACCESS_TOKEN %>", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
|
284
|
+
no_args:
|
|
285
|
+
get:
|
|
286
|
+
with_token: '{"data":[{"id": "999999999", "access_token":"<%= ACCESS_TOKEN %>", "login_url":"https://www.facebook.com/platform/test_account.."}, {"id": "888888888", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}]}'
|
|
287
|
+
|
|
288
|
+
/999999999:
|
|
289
|
+
no_args:
|
|
290
|
+
<<: *item_deleted
|
|
291
|
+
|
|
292
|
+
/999999999/friends/888888888:
|
|
293
|
+
no_args:
|
|
294
|
+
post:
|
|
295
|
+
with_token: 'true'
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
/9999999991:
|
|
299
|
+
no_args:
|
|
300
|
+
delete:
|
|
301
|
+
with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
|
302
|
+
|
|
303
|
+
/888888888:
|
|
304
|
+
no_args:
|
|
305
|
+
<<: *item_deleted
|
|
306
|
+
|
|
307
|
+
/888888888/friends/999999999:
|
|
308
|
+
no_args:
|
|
309
|
+
<<: *test_user_befriended
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
/777777777:
|
|
313
|
+
no_args:
|
|
314
|
+
<<: *item_deleted
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'although not required, bundler is recommened for running the tests'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# load the libraries
|
|
8
|
+
require 'koala'
|
|
9
|
+
|
|
10
|
+
# load testing data libraries
|
|
11
|
+
require 'support/live_testing_data_helper'
|
|
12
|
+
require 'support/mock_http_service'
|
|
13
|
+
require 'support/rest_api_shared_examples'
|
|
14
|
+
require 'support/graph_api_shared_examples'
|
|
15
|
+
require 'support/uploadable_io_shared_examples'
|
|
16
|
+
require 'support/setup_mocks_or_live'
|
|
17
|
+
|
|
18
|
+
BEACH_BALL_PATH = File.join(File.dirname(__FILE__), "fixtures", "beach.jpg")
|