# Responses by MockHTTPService are taken directly from # this file. # # Structure # ---------- # # path: # arguments: # sorted by key # method: # HTTP method (GET, POST, DELETE, etc.) # with_token: # no_token: # ====== REST API ===== rest_api: # -- Stubbed Responses -- method/fql.query: query=select first_name from user where uid = 216743: get: no_token: '[{"first_name":"Chris"}]' with_token: '[{"first_name":"Chris"}]' query=select read_stream from permissions where uid = 216743: get: with_token: '[{"read_stream":1}]' 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"}]}' # ====== GRAPH API ===== graph_api: # -- Common Responses -- # Error responses for when a token is required, but not given token_required_responses: &token_required no_token: '{"error":{"type":"OAuthAccessTokenException", "message":"An access token is required to request this resource."}}' # Common mock item responses item_deleted: &item_deleted delete: with_token: 'true' # OAuth error response oauth_error: &oauth_error no_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}' # Subscription error response verification_error: &verification_error with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}' # -- Stubbed Responses -- root: ids=contextoptional,naitik: get: with_token: '[{}, {}]' no_token: '[{}, {}]' me: no_args: get: <<: *token_required with_token: '{"updated_time": 1}' fields=id: get: with_token: '{"id": "216743"}' me/feed: message=Hello, world, from the test suite!: post: with_token: '{"id": "MOCK_FEED_ITEM"}' message=Hello, world, from the test suite, testing comments!: post: with_token: '{"id": "MOCK_FEED_ITEM"}' message=the cats are asleep: post: with_token: '{"id": "FEED_ITEM_CATS"}' message=Hello, world, from the test suite delete method!: post: with_token: '{"id": "FEED_ITEM_DELETE"}' link=http://www.contextoptional.com/&message=Hello, world, from the test suite again!&name=Context Optional: post: with_token: '{"id": "FEED_ITEM_CONTEXT"}' koppel: no_args: get: with_token: '{"id": 1, "name": 1, "updated_time": 1}' no_token: '{"id": 1, "name": 1}' contextoptional: no_args: get: with_token: '{"id": 1, "name": 1}' no_token: '{"id": 1, "name": 1}' contextoptional/likes: no_args: get: with_token: '{"data": [{}]}' no_token: '{"data": [{}]}' lukeshepard/likes: no_args: get: <<: *token_required with_token: '{"data": [{}]}' chris.baclig/picture: no_args: get: no_token: code: 302 headers: Location: http://facebook.com/ with_token: code: 302 headers: Location: http://facebook.com/ type=large: get: no_token: code: 302 headers: Location: http://facebook.com/large with_token: code: 302 headers: Location: http://facebook.com/large search: q=facebook: get: with_token: '{"data": [{"id": "507731521_100412693339488"}]}' no_token: '{"data": [{"id": "507731521_100412693339488"}]}' '115349521819193_113815981982767': no_args: delete: <<: *token_required # -- OAuth responses -- oauth/access_token: client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=<%= OAUTH_CODE %>&redirect_uri=<%= OAUTH_DATA["callback_url"] %>: get: no_token: access_token=<%= ACCESS_TOKEN %> client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=foo&redirect_uri=<%= OAUTH_DATA["callback_url"] %>: get: <<: *oauth_error client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&type=client_cred: post: no_token: access_token=<%= ACCESS_TOKEN %> oauth/exchange_sessions: client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["session_key"] %>&type=client_cred: post: no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]' client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["multiple_session_keys"].join(",") %>&type=client_cred: post: no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]' # -- Subscription Responses -- <%= APP_ID %>/subscriptions: callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>: post: with_token: code: 200 callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>foo&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>: post: with_token: '{"error":{"type":"Exception","message":"(#2200) subscription validation failed"}}' callback_url=foo&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>: post: with_token: '{"error":{"type":"Exception","message":"(#100) callback_url URL is not properly formatted"}}' object=user: delete: with_token: code: 200 object=kittens: delete: with_token: '{"error":{"type":"Exception","message":"(#100) Invalid parameter"}}' no_args: delete: with_token: code: 200 get: with_token: '{"data":[{"callback_url":"http://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}' callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>: get: with_token: '{"data":[{"callback_url":"http://oauth.twoalex.com/subscriptions", "fields":["name"], "object":"user", "active":true}]}' # -- Mock Item Responses -- MOCK_FEED_ITEM/likes: no_args: post: with_token: '{"id": "MOCK_LIKE"}' MOCK_FEED_ITEM/comments: message=it's my comment!: post: with_token: '{"id": "MOCK_COMMENT"}' MOCK_FEED_ITEM: no_args: <<: *item_deleted FEED_ITEM_CONTEXT: no_args: <<: *item_deleted get: with_token: '{"link":"http://www.contextoptional.com/", "name": "Context Optional"}' FEED_ITEM_CATS: no_args: <<: *item_deleted get: with_token: '{"message": "the cats are asleep"}' FEED_ITEM_DELETE: no_args: <<: *item_deleted MOCK_COMMENT: no_args: <<: *item_deleted get: with_token: "{\"message\": \"it\'s my comment!\"}"