Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename id param in get_object() to object_id #198

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions facebook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def __init__(self, access_token=None, timeout=None, version=None):
else:
self.version = "v" + default_version

def get_object(self, id, **args):
def get_object(self, object_id, **args):
"""Fetchs the given object from the graph."""
return self.request(self.version + "/" + id, args)
return self.request(self.version + "/" + object_id, args)

def get_objects(self, ids, **args):
"""Fetchs all of the given object from the graph.
Expand Down
13 changes: 13 additions & 0 deletions test/test_facebook.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,18 @@ def test_auth_url(self):
self.assertEqual(actual_query, expected_query)


class TestGetObject(FacebookTestCase):
def test_get_object(self):
# The value we are passing as 'fields' is valid only in 2.1+.
graph = facebook.GraphAPI(version=2.1)
graph.access_token = graph.get_app_access_token(
self.app_id, self.secret)
# We should be able to use 'id' as a keyword argument.
graph_obj = graph.get_object(
'', id='http://facebook.com', fields='og_object{comments}')

self.assertTrue(graph_obj is not None)


if __name__ == '__main__':
unittest.main()