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 3 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
12 changes: 12 additions & 0 deletions test/test_facebook.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,17 @@ 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(access_token=facebook.get_app_access_token(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

facebook.get_app_access_token is deprecated and might be removed in the near future. Can we use the GraphAPI().get_app_access_token here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. My bad on that, I followed the same pattern as a test above it which I guess hasn't been updated yet.

self.app_id, self.secret), version=2.1)
# 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()