Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FbGraph Test User
app = FbGraph::Application.new(config[:client_id], :secret => config[:client_secret])
app.test_users.collect(&:destroy)
user1 = app.test_user!(:installed => true, :permissions => :read_stream)
user2 = app.test_user!(:installed => true, :permissions => :read_stream)
p user1, user2
p user1.friend!(user2)
p user1.accounts
p user1.activities
p user1.accounts
p user1.albums
p user1.books
p user1.checkins
p user1.events
p user1.feed
p user1.friend_lists
p user1.friends
p user1.groups
p user1.home
p user1.interests
p user1.likes
p user1.links
p user1.movies
p user1.music
p user1.notes
p user1.photos
p user1.picture
p user1.posts
p user1.statuses
p user1.tagged
p user1.television
p user1.videos
@Atastor

This comment has been minimized.

Copy link

Atastor commented Dec 27, 2010

Perhaps its just me, but what threw me back initially was a confusion about "client_id" and "app_id" (despite my age I'm not the seasoned facebook-developer ;-) ). I had to use the value tagged as "app_id" in my facebook.yml here and not the one tagged "client_id".

Thanks loads!
Michael

@Atastor

This comment has been minimized.

Copy link

Atastor commented Dec 27, 2010

Addendum: Now everything seems to work fine, at least in console

@sardaukar

This comment has been minimized.

Copy link

sardaukar commented Apr 15, 2011

I get FBGraph::Exception when I try to destroy the test users... any thoughts?

@nov

This comment has been minimized.

Copy link
Owner Author

nov commented Apr 15, 2011

Rescue the error, then check error.message.
Probably you can see the error message Graph API returned.

@sardaukar

This comment has been minimized.

Copy link

sardaukar commented Apr 15, 2011

I get "(#100) Invalid value specified for param: id"

@nov

This comment has been minimized.

Copy link
Owner Author

nov commented Apr 15, 2011

@lpsBetty

This comment has been minimized.

Copy link

lpsBetty commented Jun 7, 2011

i have two old user

example:

<FbGraph::TestUser:0x000001076e5bb0 @Identifier="499102699", @endpoint="https://graph.facebook.com/499102699", @access_token=nil,..

don't know why i can't destroy 'old' users

but when I create new ones with app.test_user! it is possible to destroy them

example new user:

<FbGraph::TestUser:0x00000106055120 @Identifier="100002494629341", @endpoint="https://graph.facebook.com/100002494629341", @access_token="213439622021302|7d200a351e228508e997bd80.0-100002494629341|-8j6vBIzmb-naxjqzvQxeko-LBo", ..

so i did the following to make sure to destroy all 'new' users

app.test_users.each do |u| 
  u.destroy if u.identifier.length > 10
end
@gabealmer

This comment has been minimized.

Copy link

gabealmer commented Jun 10, 2011

It seems IpsBetty has ran into an FB bug:
http://bugs.developers.facebook.net/show_bug.cgi?id=17838

You can't delete these users now. Maybe a fix will help on FB side.

@seanski

This comment has been minimized.

Copy link

seanski commented Aug 29, 2011

@IpsBetty, I was having the same issue. I got around it by getting the access_token from the app and applying it to the test_user.

access_token = app.get_access_token
app.test_users.each do |u|
  u.access_token = access_token
  u.destroy if u.identifier.length > 10
end
@lpsBetty

This comment has been minimized.

Copy link

lpsBetty commented Aug 29, 2011

but you didn't destroy an old user after all?
because the " if u.identifier.length > 10 " represents a new user

@seanski

This comment has been minimized.

Copy link

seanski commented Aug 29, 2011

Well, I'm not sure... I didn't have the identifier length in my solution. I just put that in there for your reference. I could not delete any user accounts today. I got around it by passing the app's access token to the test user before deleting it.

@kapsdewade

This comment has been minimized.

Copy link

kapsdewade commented Jun 30, 2012

+1, working on console.... if anyone find useful..
app = FbGraph::Application.new("app_id from facebook.yml", :secret => "secrect_key from facebook.yml")

thaks

@vyruz

This comment has been minimized.

Copy link

vyruz commented Apr 17, 2014

Been trying to write some feature tests in cucumber but when i try to follow the sign in i get an error
uninitialized constant OauthController
Would anyone be kind enough to help me out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.