# 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."}}' test_user_no_perms: &test_user_no_perms post: with_token: '{"id": "777777777", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}' # -- 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"}' /me/photos: source=[FILE]: post: <<: *token_required with_token: '{"id": "MOCK_PHOTO"}' message=This is the test message&source=[FILE]: post: <<: *token_required with_token: '{"id": "MOCK_PHOTO"}' /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/photos: no_args: get: 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"}}' 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"}}' /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"}], "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"}}' 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"}}' "limit=25&q=facebook&until=2010-09-23T21:17:33+0000": get: 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"}}' 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"}}' '/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}]' client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= ["foo"].concat(OAUTH_DATA["multiple_session_keys"]).join(",") %>&type=client_cred: post: no_token: '[null, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]' client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo,bar&type=client_cred: post: no_token: '[null, null]' client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo&type=client_cred: post: no_token: '[null]' # -- 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 /FEED_ITEM_DELETE/likes: no_args: <<: *item_deleted post: with_token: 'true' /MOCK_COMMENT: no_args: <<: *item_deleted get: with_token: "{\"message\": \"it\'s my comment!\"}" /MOCK_PHOTO: no_args: <<: *item_deleted get: with_token: "{\"name\": \"This is the test message\"}" # -- Mock Test User Responses -- /<%= APP_ID %>/accounts/test-users: installed=false: <<: *test_user_no_perms installed=false&permissions=read_stream: <<: *test_user_no_perms installed=true&permissions=read_stream: post: with_token: '{"id": "999999999", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}' installed=true&permissions=read_stream,user_interests: post: with_token: '{"id": "888888888", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}' no_args: get: with_token: '{"data":[{"id": "999999999", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "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.."}]}' /999999999: no_args: <<: *item_deleted /9999999991: no_args: delete: with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}' /888888888: no_args: <<: *item_deleted /777777777: no_args: <<: *item_deleted /999999999/friends/888888888: no_args: get: with_token: 'true' /888888888/friends/999999999: no_args: get: with_token: 'true'