Created
December 2, 2013 15:57
-
-
Save sunglassatnight/7751680 to your computer and use it in GitHub Desktop.
foursquare auth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pingspot.dal.users import UserService | |
from sys import uuid | |
def test_foursquare_auth_token(dal, uniqueuser): | |
user = uniqueuser() | |
auth_token = str(uuid.uuid4()) | |
user.foursquare_auth_token = auth_token | |
saved_user = UserService.users.get_or_create_by_social_identifier(user) | |
assert user.foursquare_auth_token == auth_token | |
assert user.foursquare_auth_token == saved_user.foursquare_auth_token |
UserService.users.get_or_create_by_social_identifier(user)
should actually be dal.users.get_or_create_by_social_identifier(user)
. However, as we discussed in chat, what we need here is dal.users.set_foursquare_auth_token(user, token)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 3 = when you call the uuid.uuid4 function (like this
uuid.uuid4()
, you're getting auuid
object back, so you don't need to call it again on like 7. since your variable is storing an object, it should be named like a noun -auth_token
, not a verb phrase (get_blah_blah
).also, there's no reason to have a module level variable for this thing - go ahead and move it into the test function.
also, I just happen to know that the result of
uuid.uuid4()
is not a string, so you'll need to create a string out of it by calling thestr
function with the value of theuuid.uuid4()
function, like this: