koala 1.0.0.beta2.1 → 1.0.0.rc
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/CHANGELOG +6 -1
- data/Gemfile +3 -0
- data/Rakefile +13 -14
- data/koala.gemspec +35 -20
- data/lib/koala.rb +8 -17
- data/lib/koala/graph_api.rb +2 -2
- data/lib/koala/http_services.rb +32 -27
- data/lib/koala/test_users.rb +4 -4
- data/lib/koala/uploadable_io.rb +1 -1
- 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/{koala/http_services/http_service_tests.rb → cases/http_services/http_service_spec.rb} +8 -5
- 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 +374 -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} +34 -29
- data/spec/cases/uploadable_io_spec.rb +151 -0
- data/spec/{koala/assets → fixtures}/beach.jpg +0 -0
- data/spec/{facebook_data.yml → fixtures/facebook_data.yml} +5 -5
- data/spec/{mock_facebook_responses.yml → fixtures/mock_facebook_responses.yml} +311 -311
- 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 -94
- data/spec/{koala/rest_api/rest_api_tests.rb → support/rest_api_shared_examples.rb} +43 -0
- data/spec/support/setup_mocks_or_live.rb +52 -0
- data/spec/support/uploadable_io_shared_examples.rb +76 -0
- metadata +109 -53
- 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 -14
- data/spec/koala/graph_and_rest_api/graph_and_rest_api_with_token_tests.rb +0 -16
- data/spec/koala/graph_api/graph_api_no_access_token_tests.rb +0 -65
- data/spec/koala/graph_api/graph_api_tests.rb +0 -85
- data/spec/koala/graph_api/graph_api_with_access_token_tests.rb +0 -194
- data/spec/koala/graph_api/graph_collection_tests.rb +0 -104
- data/spec/koala/http_services/net_http_service_tests.rb +0 -339
- data/spec/koala/http_services/typhoeus_service_tests.rb +0 -162
- data/spec/koala/oauth/oauth_tests.rb +0 -372
- data/spec/koala/realtime_updates/realtime_updates_tests.rb +0 -187
- data/spec/koala/rest_api/rest_api_no_access_token_tests.rb +0 -25
- data/spec/koala/rest_api/rest_api_with_access_token_tests.rb +0 -38
- data/spec/koala/uploadable_io/uploadable_io_tests.rb +0 -246
- data/spec/koala_spec.rb +0 -18
- data/spec/koala_spec_helper.rb +0 -74
- data/spec/koala_spec_without_mocks.rb +0 -19
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Koala::Facebook::RestAPI" do
|
4
|
+
|
5
|
+
context "without an access token" do
|
6
|
+
before :each do
|
7
|
+
@api = Koala::Facebook::RestAPI.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it_should_behave_like "Koala RestAPI"
|
11
|
+
it_should_behave_like "Koala RestAPI without an access token"
|
12
|
+
end
|
13
|
+
|
14
|
+
context "with an access token" do
|
15
|
+
include LiveTestingDataHelper
|
16
|
+
|
17
|
+
before :each do
|
18
|
+
@api = Koala::Facebook::RestAPI.new(@token)
|
19
|
+
end
|
20
|
+
|
21
|
+
it_should_behave_like "Koala RestAPI"
|
22
|
+
it_should_behave_like "Koala RestAPI with an access token"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
include Koala
|
1
|
+
require 'spec_helper'
|
3
2
|
|
4
|
-
|
3
|
+
describe "Koala::Facebook::TestUsers" do
|
4
|
+
context "with access token" do
|
5
5
|
include LiveTestingDataHelper
|
6
6
|
|
7
7
|
before :all do
|
@@ -22,28 +22,28 @@ class TestUsersTests < Test::Unit::TestCase
|
|
22
22
|
describe "when initializing" do
|
23
23
|
# basic initialization
|
24
24
|
it "should initialize properly with an app_id and an app_access_token" do
|
25
|
-
test_users = Facebook::TestUsers.new(:app_id => @app_id, :app_access_token => @app_access_token)
|
26
|
-
test_users.should be_a(Facebook::TestUsers)
|
25
|
+
test_users = Koala::Facebook::TestUsers.new(:app_id => @app_id, :app_access_token => @app_access_token)
|
26
|
+
test_users.should be_a(Koala::Facebook::TestUsers)
|
27
27
|
end
|
28
28
|
|
29
29
|
# init with secret / fetching the token
|
30
30
|
it "should initialize properly with an app_id and a secret" do
|
31
|
-
test_users = Facebook::TestUsers.new(:app_id => @app_id, :secret => @secret)
|
32
|
-
test_users.should be_a(Facebook::TestUsers)
|
31
|
+
test_users = Koala::Facebook::TestUsers.new(:app_id => @app_id, :secret => @secret)
|
32
|
+
test_users.should be_a(Koala::Facebook::TestUsers)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should use the OAuth class to fetch a token when provided an app_id and a secret" do
|
36
|
-
oauth = Facebook::OAuth.new(@app_id, @secret)
|
36
|
+
oauth = Koala::Facebook::OAuth.new(@app_id, @secret)
|
37
37
|
token = oauth.get_app_access_token
|
38
38
|
oauth.should_receive(:get_app_access_token).and_return(token)
|
39
|
-
Facebook::OAuth.should_receive(:new).with(@app_id, @secret).and_return(oauth)
|
40
|
-
test_users = Facebook::TestUsers.new(:app_id => @app_id, :secret => @secret)
|
39
|
+
Koala::Facebook::OAuth.should_receive(:new).with(@app_id, @secret).and_return(oauth)
|
40
|
+
test_users = Koala::Facebook::TestUsers.new(:app_id => @app_id, :secret => @secret)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "when used without network" do
|
45
45
|
before :each do
|
46
|
-
@test_users = Facebook::TestUsers.new({:app_access_token => @app_access_token, :app_id => @app_id})
|
46
|
+
@test_users = Koala::Facebook::TestUsers.new({:app_access_token => @app_access_token, :app_id => @app_id})
|
47
47
|
end
|
48
48
|
|
49
49
|
# TEST USER MANAGEMENT
|
@@ -62,12 +62,12 @@ class TestUsersTests < Test::Unit::TestCase
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should accept permissions as a string" do
|
65
|
-
@test_users.graph_api.should_receive(:graph_call).with(anything, hash_including("permissions" => "read_stream,publish_stream"), anything)
|
65
|
+
@test_users.graph_api.should_receive(:graph_call).with(anything, hash_including("permissions" => "read_stream,publish_stream"), anything, anything)
|
66
66
|
result = @test_users.create(true, "read_stream,publish_stream")
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should accept permissions as an array" do
|
70
|
-
@test_users.graph_api.should_receive(:graph_call).with(anything, hash_including("permissions" => "read_stream,publish_stream"), anything)
|
70
|
+
@test_users.graph_api.should_receive(:graph_call).with(anything, hash_including("permissions" => "read_stream,publish_stream"), anything, anything)
|
71
71
|
result = @test_users.create(true, ["read_stream", "publish_stream"])
|
72
72
|
end
|
73
73
|
|
@@ -78,6 +78,18 @@ class TestUsersTests < Test::Unit::TestCase
|
|
78
78
|
(result["id"] && result["access_token"] && result["login_url"]).should
|
79
79
|
end
|
80
80
|
|
81
|
+
it "lets you specify other graph arguments, like uid and access token" do
|
82
|
+
args = {:uid => "some test user ID", :owner_access_token => "some owner access token"}
|
83
|
+
@test_users.graph_api.should_receive(:graph_call).with(anything, hash_including(args), anything, anything)
|
84
|
+
@test_users.create(true, nil, args)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "lets you specify http options that get passed through to the graph call" do
|
88
|
+
options = {:some_http_option => true}
|
89
|
+
@test_users.graph_api.should_receive(:graph_call).with(anything, anything, anything, options)
|
90
|
+
@test_users.create(true, nil, {}, options)
|
91
|
+
end
|
92
|
+
|
81
93
|
describe "with a user to delete" do
|
82
94
|
before :each do
|
83
95
|
@user1 = @test_users.create(true, "read_stream")
|
@@ -85,10 +97,8 @@ class TestUsersTests < Test::Unit::TestCase
|
|
85
97
|
end
|
86
98
|
|
87
99
|
after :each do
|
88
|
-
print "\nCleaning up test users..."
|
89
100
|
@test_users.delete(@user1) if @user1
|
90
101
|
@test_users.delete(@user2) if @user2
|
91
|
-
puts "done."
|
92
102
|
end
|
93
103
|
|
94
104
|
it "should delete a user by id" do
|
@@ -133,22 +143,22 @@ class TestUsersTests < Test::Unit::TestCase
|
|
133
143
|
(first_user["id"] && first_user["access_token"] && first_user["login_url"]).should
|
134
144
|
(second_user["id"] && second_user["access_token"] && second_user["login_url"]).should
|
135
145
|
end
|
136
|
-
|
146
|
+
|
137
147
|
it "should make two users into friends with string hashes" do
|
138
148
|
result = @test_users.befriend(@user1, @user2)
|
139
149
|
result.should be_true
|
140
150
|
end
|
141
|
-
|
151
|
+
|
142
152
|
it "should make two users into friends with symbol hashes" do
|
143
153
|
new_user_1 = {}
|
144
154
|
@user1.each_pair {|k, v| new_user_1[k.to_sym] = v}
|
145
155
|
new_user_2 = {}
|
146
156
|
@user2.each_pair {|k, v| new_user_2[k.to_sym] = v}
|
147
|
-
|
157
|
+
|
148
158
|
result = @test_users.befriend(new_user_1, new_user_2)
|
149
159
|
result.should be_true
|
150
160
|
end
|
151
|
-
|
161
|
+
|
152
162
|
it "should not accept user IDs anymore" do
|
153
163
|
lambda { @test_users.befriend(@user1["id"], @user2["id"]) }.should raise_exception
|
154
164
|
end
|
@@ -158,7 +168,7 @@ class TestUsersTests < Test::Unit::TestCase
|
|
158
168
|
|
159
169
|
describe "when creating a network of friends" do
|
160
170
|
before :each do
|
161
|
-
@test_users = Facebook::TestUsers.new({:app_access_token => @app_access_token, :app_id => @app_id})
|
171
|
+
@test_users = Koala::Facebook::TestUsers.new({:app_access_token => @app_access_token, :app_id => @app_id})
|
162
172
|
@network = []
|
163
173
|
|
164
174
|
if @is_mock
|
@@ -174,17 +184,13 @@ class TestUsersTests < Test::Unit::TestCase
|
|
174
184
|
|
175
185
|
describe "tests that create users" do
|
176
186
|
before :each do
|
177
|
-
|
178
|
-
test_users = Facebook::TestUsers.new({:app_access_token => @app_access_token, :app_id => @app_id})
|
187
|
+
test_users = Koala::Facebook::TestUsers.new({:app_access_token => @app_access_token, :app_id => @app_id})
|
179
188
|
test_users.delete_all
|
180
|
-
puts "done!"
|
181
189
|
end
|
182
190
|
|
183
191
|
after :each do
|
184
|
-
|
185
|
-
test_users = Facebook::TestUsers.new({:app_access_token => @app_access_token, :app_id => @app_id})
|
192
|
+
test_users = Koala::Facebook::TestUsers.new({:app_access_token => @app_access_token, :app_id => @app_id})
|
186
193
|
test_users.delete_all
|
187
|
-
puts "done!"
|
188
194
|
end
|
189
195
|
|
190
196
|
it "should create a 5 person network" do
|
@@ -211,6 +217,5 @@ class TestUsersTests < Test::Unit::TestCase
|
|
211
217
|
end
|
212
218
|
|
213
219
|
end # when creating network
|
214
|
-
|
215
|
-
|
216
|
-
end # class
|
220
|
+
end
|
221
|
+
end # describe Koala TestUsers
|
@@ -0,0 +1,151 @@
|
|
1
|
+
# fake MIME::Types
|
2
|
+
module Koala::MIME
|
3
|
+
module Types
|
4
|
+
def self.type_for(type)
|
5
|
+
# this should be faked out in tests
|
6
|
+
nil
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "Koala::UploadableIO" do
|
12
|
+
describe "the constructor" do
|
13
|
+
describe "when given a file path" do
|
14
|
+
before(:each) do
|
15
|
+
@koala_io_params = [File.open(BEACH_BALL_PATH)]
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "and a content type" do
|
19
|
+
before :each do
|
20
|
+
@koala_io_params.concat([stub("image/jpg")])
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return an UploadIO with the same file path" do
|
24
|
+
stub_path = @koala_io_params[0] = "/stub/path/to/file"
|
25
|
+
Koala::UploadableIO.new(*@koala_io_params).io_or_path.should == stub_path
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return an UploadIO with the same content type" do
|
29
|
+
stub_type = @koala_io_params[1] = stub('Content Type')
|
30
|
+
Koala::UploadableIO.new(*@koala_io_params).content_type.should == stub_type
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "and no content type" do
|
35
|
+
it_should_behave_like "determining a mime type"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "when given a File object" do
|
40
|
+
before(:each) do
|
41
|
+
@koala_io_params = [File.open(BEACH_BALL_PATH)]
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "and a content type" do
|
45
|
+
before :each do
|
46
|
+
@koala_io_params.concat(["image/jpg"])
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return an UploadIO with the same io" do
|
50
|
+
Koala::UploadableIO.new(*@koala_io_params).io_or_path.should == @koala_io_params[0]
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return an UplaodIO with the same content_type" do
|
54
|
+
content_stub = @koala_io_params[1] = stub('Content Type')
|
55
|
+
Koala::UploadableIO.new(*@koala_io_params).content_type.should == content_stub
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "and no content type" do
|
60
|
+
it_should_behave_like "determining a mime type"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "when given a Rails 3 ActionDispatch::Http::UploadedFile" do
|
65
|
+
before(:each) do
|
66
|
+
@tempfile = stub('Tempfile', :path => "foo")
|
67
|
+
@uploaded_file = stub('ActionDispatch::Http::UploadedFile',
|
68
|
+
:content_type => true,
|
69
|
+
:tempfile => @tempfile
|
70
|
+
)
|
71
|
+
|
72
|
+
@tempfile.stub!(:respond_to?).with(:path).and_return(true)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should get the content type via the content_type method" do
|
76
|
+
expected_content_type = stub('Content Type')
|
77
|
+
@uploaded_file.should_receive(:content_type).and_return(expected_content_type)
|
78
|
+
Koala::UploadableIO.new(@uploaded_file).content_type.should == expected_content_type
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should get the path from the tempfile associated with the UploadedFile" do
|
82
|
+
expected_path = stub('Tempfile')
|
83
|
+
@tempfile.should_receive(:path).and_return(expected_path)
|
84
|
+
Koala::UploadableIO.new(@uploaded_file).io_or_path.should == expected_path
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "when given a Sinatra file parameter hash" do
|
89
|
+
before(:each) do
|
90
|
+
@file_hash = {
|
91
|
+
:type => "type",
|
92
|
+
:tempfile => "Tempfile"
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should get the content type from the :type key" do
|
97
|
+
expected_content_type = stub('Content Type')
|
98
|
+
@file_hash[:type] = expected_content_type
|
99
|
+
|
100
|
+
uploadable = Koala::UploadableIO.new(@file_hash)
|
101
|
+
uploadable.content_type.should == expected_content_type
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should get the io_or_path from the :tempfile key" do
|
105
|
+
expected_file = stub('File')
|
106
|
+
@file_hash[:tempfile] = expected_file
|
107
|
+
|
108
|
+
uploadable = Koala::UploadableIO.new(@file_hash)
|
109
|
+
uploadable.io_or_path.should == expected_file
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "for files with with recognizable MIME types" do
|
114
|
+
# what that means is tested below
|
115
|
+
it "should accept a file object alone" do
|
116
|
+
params = [BEACH_BALL_PATH]
|
117
|
+
lambda { Koala::UploadableIO.new(*params) }.should_not raise_exception(Koala::KoalaError)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should accept a file path alone" do
|
121
|
+
params = [BEACH_BALL_PATH]
|
122
|
+
lambda { Koala::UploadableIO.new(*params) }.should_not raise_exception(Koala::KoalaError)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe "getting an UploadableIO" do
|
128
|
+
before(:each) do
|
129
|
+
@upload_io = stub("UploadIO")
|
130
|
+
UploadIO.stub!(:new).with(anything, anything, anything).and_return(@upload_io)
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should call the constructor with the content type, file name, and a dummy file name" do
|
134
|
+
UploadIO.should_receive(:new).with(BEACH_BALL_PATH, "content/type", anything).and_return(@upload_io)
|
135
|
+
Koala::UploadableIO.new(BEACH_BALL_PATH, "content/type").to_upload_io.should == @upload_io
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe "getting a file" do
|
140
|
+
it "should return the File if initialized with a file" do
|
141
|
+
f = File.new(BEACH_BALL_PATH)
|
142
|
+
Koala::UploadableIO.new(f).to_file.should == f
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should open up and return a file corresponding to the path if io_or_path is a path" do
|
146
|
+
result = stub("File")
|
147
|
+
File.should_receive(:open).with(BEACH_BALL_PATH).and_return(result)
|
148
|
+
Koala::UploadableIO.new(BEACH_BALL_PATH).to_file.should == result
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end # describe UploadableIO
|
File without changes
|
@@ -5,18 +5,18 @@
|
|
5
5
|
|
6
6
|
# You must supply this value yourself to test the GraphAPI class.
|
7
7
|
# Your OAuth token should have publish_stream, read_stream, and user_photos permissions.
|
8
|
-
oauth_token:
|
8
|
+
oauth_token:
|
9
9
|
|
10
10
|
# for testing the OAuth class
|
11
11
|
# baseline app
|
12
12
|
oauth_test_data:
|
13
13
|
# You must supply this value yourself, since they will expire.
|
14
|
-
code:
|
14
|
+
code:
|
15
15
|
# easiest way to get session keys: use multiple test accounts with the Javascript login at http://oauth.twoalex.com
|
16
|
-
session_key:
|
16
|
+
session_key:
|
17
17
|
multiple_session_keys:
|
18
|
-
-
|
19
|
-
-
|
18
|
+
-
|
19
|
+
-
|
20
20
|
|
21
21
|
# These values will work out of the box
|
22
22
|
app_id: 119908831367602
|
@@ -1,312 +1,312 @@
|
|
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
|
-
/chris.baclig/picture:
|
123
|
-
no_args:
|
124
|
-
get:
|
125
|
-
no_token:
|
126
|
-
code: 302
|
127
|
-
headers:
|
128
|
-
Location: http://facebook.com/
|
129
|
-
with_token:
|
130
|
-
code: 302
|
131
|
-
headers:
|
132
|
-
Location: http://facebook.com/
|
133
|
-
type=large:
|
134
|
-
get:
|
135
|
-
no_token:
|
136
|
-
code: 302
|
137
|
-
headers:
|
138
|
-
Location: http://facebook.com/large
|
139
|
-
with_token:
|
140
|
-
code: 302
|
141
|
-
headers:
|
142
|
-
Location: http://facebook.com/large
|
143
|
-
|
144
|
-
|
145
|
-
/search:
|
146
|
-
q=facebook:
|
147
|
-
get:
|
148
|
-
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"}}'
|
149
|
-
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"}}'
|
150
|
-
"limit=25&q=facebook&until=2010-09-23T21:17:33+0000":
|
151
|
-
get:
|
152
|
-
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"}}'
|
153
|
-
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"}}'
|
154
|
-
|
155
|
-
'/115349521819193_113815981982767':
|
156
|
-
no_args:
|
157
|
-
delete:
|
158
|
-
<<: *token_required
|
159
|
-
|
160
|
-
# -- OAuth responses --
|
161
|
-
/oauth/access_token:
|
162
|
-
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=<%= OAUTH_CODE %>&redirect_uri=<%= OAUTH_DATA["callback_url"] %>:
|
163
|
-
get:
|
164
|
-
no_token: access_token=<%= ACCESS_TOKEN %>
|
165
|
-
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=foo&redirect_uri=<%= OAUTH_DATA["callback_url"] %>:
|
166
|
-
get:
|
167
|
-
<<: *oauth_error
|
168
|
-
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&type=client_cred:
|
169
|
-
post:
|
170
|
-
no_token: access_token=<%= ACCESS_TOKEN %>
|
171
|
-
/oauth/exchange_sessions:
|
172
|
-
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["session_key"] %>&type=client_cred:
|
173
|
-
post:
|
174
|
-
no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
175
|
-
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["multiple_session_keys"].join(",") %>&type=client_cred:
|
176
|
-
post:
|
177
|
-
no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
178
|
-
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= ["foo"].concat(OAUTH_DATA["multiple_session_keys"]).join(",") %>&type=client_cred:
|
179
|
-
post:
|
180
|
-
no_token: '[null, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
181
|
-
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo,bar&type=client_cred:
|
182
|
-
post:
|
183
|
-
no_token: '[null, null]'
|
184
|
-
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo&type=client_cred:
|
185
|
-
post:
|
186
|
-
no_token: '[null]'
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
# -- Subscription Responses --
|
191
|
-
/<%= APP_ID %>/subscriptions:
|
192
|
-
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
193
|
-
post:
|
194
|
-
with_token:
|
195
|
-
code: 200
|
196
|
-
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>foo&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
197
|
-
post:
|
198
|
-
with_token: '{"error":{"type":"Exception","message":"(#2200) subscription validation failed"}}'
|
199
|
-
callback_url=foo&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
200
|
-
post:
|
201
|
-
with_token: '{"error":{"type":"Exception","message":"(#100) callback_url URL is not properly formatted"}}'
|
202
|
-
object=user:
|
203
|
-
delete:
|
204
|
-
with_token:
|
205
|
-
code: 200
|
206
|
-
object=kittens:
|
207
|
-
delete:
|
208
|
-
with_token: '{"error":{"type":"Exception","message":"(#100) Invalid parameter"}}'
|
209
|
-
no_args:
|
210
|
-
delete:
|
211
|
-
with_token:
|
212
|
-
code: 200
|
213
|
-
get:
|
214
|
-
with_token: '{"data":[{"callback_url":"http://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}'
|
215
|
-
|
216
|
-
|
217
|
-
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>:
|
218
|
-
get:
|
219
|
-
with_token: '{"data":[{"callback_url":"http://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}'
|
220
|
-
|
221
|
-
# -- Mock Item Responses --
|
222
|
-
|
223
|
-
/MOCK_FEED_ITEM/likes:
|
224
|
-
no_args:
|
225
|
-
post:
|
226
|
-
with_token: '{"id": "MOCK_LIKE"}'
|
227
|
-
|
228
|
-
/MOCK_FEED_ITEM/comments:
|
229
|
-
message=it's my comment!:
|
230
|
-
post:
|
231
|
-
with_token: '{"id": "MOCK_COMMENT"}'
|
232
|
-
|
233
|
-
/MOCK_FEED_ITEM:
|
234
|
-
no_args:
|
235
|
-
<<: *item_deleted
|
236
|
-
|
237
|
-
/FEED_ITEM_CONTEXT:
|
238
|
-
no_args:
|
239
|
-
<<: *item_deleted
|
240
|
-
get:
|
241
|
-
with_token: '{"link":"http://oauth.twoalex.com/", "name": "OAuth Playground"}'
|
242
|
-
|
243
|
-
/FEED_ITEM_CATS:
|
244
|
-
no_args:
|
245
|
-
<<: *item_deleted
|
246
|
-
get:
|
247
|
-
with_token: '{"message": "the cats are asleep"}'
|
248
|
-
|
249
|
-
/FEED_ITEM_DELETE:
|
250
|
-
no_args:
|
251
|
-
<<: *item_deleted
|
252
|
-
|
253
|
-
/FEED_ITEM_DELETE/likes:
|
254
|
-
no_args:
|
255
|
-
<<: *item_deleted
|
256
|
-
post:
|
257
|
-
with_token: 'true'
|
258
|
-
|
259
|
-
/MOCK_COMMENT:
|
260
|
-
no_args:
|
261
|
-
<<: *item_deleted
|
262
|
-
get:
|
263
|
-
with_token: "{\"message\": \"it
|
264
|
-
/MOCK_PHOTO:
|
265
|
-
no_args:
|
266
|
-
<<: *item_deleted
|
267
|
-
get:
|
268
|
-
with_token: "{\"name\": \"This is the test message\"}"
|
269
|
-
|
270
|
-
# -- Mock Test User Responses --
|
271
|
-
/<%= APP_ID %>/accounts/test-users:
|
272
|
-
installed=false:
|
273
|
-
<<: *test_user_no_perms
|
274
|
-
installed=false&permissions=read_stream:
|
275
|
-
<<: *test_user_no_perms
|
276
|
-
installed=true&permissions=read_stream:
|
277
|
-
post:
|
278
|
-
with_token: '{"id": "999999999", "access_token":"<%= ACCESS_TOKEN %>", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
279
|
-
installed=true&permissions=read_stream,user_interests:
|
280
|
-
post:
|
281
|
-
with_token: '{"id": "888888888", "access_token":"<%= ACCESS_TOKEN %>", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
282
|
-
no_args:
|
283
|
-
get:
|
284
|
-
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.."}]}'
|
285
|
-
|
286
|
-
/999999999:
|
287
|
-
no_args:
|
288
|
-
<<: *item_deleted
|
289
|
-
|
290
|
-
/999999999/friends/888888888:
|
291
|
-
no_args:
|
292
|
-
post:
|
293
|
-
with_token: 'true'
|
294
|
-
|
295
|
-
|
296
|
-
/9999999991:
|
297
|
-
no_args:
|
298
|
-
delete:
|
299
|
-
with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
300
|
-
|
301
|
-
/888888888:
|
302
|
-
no_args:
|
303
|
-
<<: *item_deleted
|
304
|
-
|
305
|
-
/888888888/friends/999999999:
|
306
|
-
no_args:
|
307
|
-
<<: *test_user_befriended
|
308
|
-
|
309
|
-
|
310
|
-
/777777777:
|
311
|
-
no_args:
|
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
|
+
/chris.baclig/picture:
|
123
|
+
no_args:
|
124
|
+
get:
|
125
|
+
no_token:
|
126
|
+
code: 302
|
127
|
+
headers:
|
128
|
+
Location: http://facebook.com/
|
129
|
+
with_token:
|
130
|
+
code: 302
|
131
|
+
headers:
|
132
|
+
Location: http://facebook.com/
|
133
|
+
type=large:
|
134
|
+
get:
|
135
|
+
no_token:
|
136
|
+
code: 302
|
137
|
+
headers:
|
138
|
+
Location: http://facebook.com/large
|
139
|
+
with_token:
|
140
|
+
code: 302
|
141
|
+
headers:
|
142
|
+
Location: http://facebook.com/large
|
143
|
+
|
144
|
+
|
145
|
+
/search:
|
146
|
+
q=facebook:
|
147
|
+
get:
|
148
|
+
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"}}'
|
149
|
+
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"}}'
|
150
|
+
"limit=25&q=facebook&until=2010-09-23T21:17:33+0000":
|
151
|
+
get:
|
152
|
+
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"}}'
|
153
|
+
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"}}'
|
154
|
+
|
155
|
+
'/115349521819193_113815981982767':
|
156
|
+
no_args:
|
157
|
+
delete:
|
158
|
+
<<: *token_required
|
159
|
+
|
160
|
+
# -- OAuth responses --
|
161
|
+
/oauth/access_token:
|
162
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=<%= OAUTH_CODE %>&redirect_uri=<%= OAUTH_DATA["callback_url"] %>:
|
163
|
+
get:
|
164
|
+
no_token: access_token=<%= ACCESS_TOKEN %>
|
165
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=foo&redirect_uri=<%= OAUTH_DATA["callback_url"] %>:
|
166
|
+
get:
|
167
|
+
<<: *oauth_error
|
168
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&type=client_cred:
|
169
|
+
post:
|
170
|
+
no_token: access_token=<%= ACCESS_TOKEN %>
|
171
|
+
/oauth/exchange_sessions:
|
172
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["session_key"] %>&type=client_cred:
|
173
|
+
post:
|
174
|
+
no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
175
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["multiple_session_keys"].join(",") %>&type=client_cred:
|
176
|
+
post:
|
177
|
+
no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
178
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= ["foo"].concat(OAUTH_DATA["multiple_session_keys"]).join(",") %>&type=client_cred:
|
179
|
+
post:
|
180
|
+
no_token: '[null, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
181
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo,bar&type=client_cred:
|
182
|
+
post:
|
183
|
+
no_token: '[null, null]'
|
184
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo&type=client_cred:
|
185
|
+
post:
|
186
|
+
no_token: '[null]'
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
# -- Subscription Responses --
|
191
|
+
/<%= APP_ID %>/subscriptions:
|
192
|
+
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
193
|
+
post:
|
194
|
+
with_token:
|
195
|
+
code: 200
|
196
|
+
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>foo&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
197
|
+
post:
|
198
|
+
with_token: '{"error":{"type":"Exception","message":"(#2200) subscription validation failed"}}'
|
199
|
+
callback_url=foo&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
200
|
+
post:
|
201
|
+
with_token: '{"error":{"type":"Exception","message":"(#100) callback_url URL is not properly formatted"}}'
|
202
|
+
object=user:
|
203
|
+
delete:
|
204
|
+
with_token:
|
205
|
+
code: 200
|
206
|
+
object=kittens:
|
207
|
+
delete:
|
208
|
+
with_token: '{"error":{"type":"Exception","message":"(#100) Invalid parameter"}}'
|
209
|
+
no_args:
|
210
|
+
delete:
|
211
|
+
with_token:
|
212
|
+
code: 200
|
213
|
+
get:
|
214
|
+
with_token: '{"data":[{"callback_url":"http://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}'
|
215
|
+
|
216
|
+
|
217
|
+
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>:
|
218
|
+
get:
|
219
|
+
with_token: '{"data":[{"callback_url":"http://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}'
|
220
|
+
|
221
|
+
# -- Mock Item Responses --
|
222
|
+
|
223
|
+
/MOCK_FEED_ITEM/likes:
|
224
|
+
no_args:
|
225
|
+
post:
|
226
|
+
with_token: '{"id": "MOCK_LIKE"}'
|
227
|
+
|
228
|
+
/MOCK_FEED_ITEM/comments:
|
229
|
+
message=it's my comment!:
|
230
|
+
post:
|
231
|
+
with_token: '{"id": "MOCK_COMMENT"}'
|
232
|
+
|
233
|
+
/MOCK_FEED_ITEM:
|
234
|
+
no_args:
|
235
|
+
<<: *item_deleted
|
236
|
+
|
237
|
+
/FEED_ITEM_CONTEXT:
|
238
|
+
no_args:
|
239
|
+
<<: *item_deleted
|
240
|
+
get:
|
241
|
+
with_token: '{"link":"http://oauth.twoalex.com/", "name": "OAuth Playground"}'
|
242
|
+
|
243
|
+
/FEED_ITEM_CATS:
|
244
|
+
no_args:
|
245
|
+
<<: *item_deleted
|
246
|
+
get:
|
247
|
+
with_token: '{"message": "the cats are asleep"}'
|
248
|
+
|
249
|
+
/FEED_ITEM_DELETE:
|
250
|
+
no_args:
|
251
|
+
<<: *item_deleted
|
252
|
+
|
253
|
+
/FEED_ITEM_DELETE/likes:
|
254
|
+
no_args:
|
255
|
+
<<: *item_deleted
|
256
|
+
post:
|
257
|
+
with_token: 'true'
|
258
|
+
|
259
|
+
/MOCK_COMMENT:
|
260
|
+
no_args:
|
261
|
+
<<: *item_deleted
|
262
|
+
get:
|
263
|
+
with_token: "{\"message\": \"it's my comment!\"}"
|
264
|
+
/MOCK_PHOTO:
|
265
|
+
no_args:
|
266
|
+
<<: *item_deleted
|
267
|
+
get:
|
268
|
+
with_token: "{\"name\": \"This is the test message\"}"
|
269
|
+
|
270
|
+
# -- Mock Test User Responses --
|
271
|
+
/<%= APP_ID %>/accounts/test-users:
|
272
|
+
installed=false:
|
273
|
+
<<: *test_user_no_perms
|
274
|
+
installed=false&permissions=read_stream:
|
275
|
+
<<: *test_user_no_perms
|
276
|
+
installed=true&permissions=read_stream:
|
277
|
+
post:
|
278
|
+
with_token: '{"id": "999999999", "access_token":"<%= ACCESS_TOKEN %>", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
279
|
+
installed=true&permissions=read_stream,user_interests:
|
280
|
+
post:
|
281
|
+
with_token: '{"id": "888888888", "access_token":"<%= ACCESS_TOKEN %>", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
282
|
+
no_args:
|
283
|
+
get:
|
284
|
+
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.."}]}'
|
285
|
+
|
286
|
+
/999999999:
|
287
|
+
no_args:
|
288
|
+
<<: *item_deleted
|
289
|
+
|
290
|
+
/999999999/friends/888888888:
|
291
|
+
no_args:
|
292
|
+
post:
|
293
|
+
with_token: 'true'
|
294
|
+
|
295
|
+
|
296
|
+
/9999999991:
|
297
|
+
no_args:
|
298
|
+
delete:
|
299
|
+
with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
300
|
+
|
301
|
+
/888888888:
|
302
|
+
no_args:
|
303
|
+
<<: *item_deleted
|
304
|
+
|
305
|
+
/888888888/friends/999999999:
|
306
|
+
no_args:
|
307
|
+
<<: *test_user_befriended
|
308
|
+
|
309
|
+
|
310
|
+
/777777777:
|
311
|
+
no_args:
|
312
312
|
<<: *item_deleted
|