def test_destroy_friendship_user_id(auth1,auth2,user_info,create_friend,destroy_friend): user2 = UserKeys().user2() # get user 2's info from hidden class follow_data = create_friend(auth1,user_id=user2["user_id"])# user1 follows user2 unfollow_data = destroy_friend(auth1, user_id=user2["user_id"]) # user1 unfollows user2 assert not "errors" in unfollow_data assert str(unfollow_data["id"]) == user2["user_id"]
def test_destroy_friendship_screen_name(auth1,auth2,user_info,create_friend,destroy_friend): user2 = UserKeys().user2() # get user 2's info from hidden class follow_data = create_friend(auth1,screen_name=user2["screen_name"])# user1 follows user2 unfollow_data = destroy_friend(auth1, screen_name=user2["screen_name"]) # user1 unfollows user2 assert not "errors" in unfollow_data assert unfollow_data["screen_name"] == user2["screen_name"]
def test_create_friendship_user_id(auth1,auth2,user_info, create_friend,destroy_friend): user2 = UserKeys().user2() # get user2's info from hidden class data = create_friend(auth1,user_id=user2["user_id"]) #have user1 follow user2 destroy_friend(auth1, user_id=user2["user_id"]) # user1 unfollows user2 to reset env assert not "errors" in data assert str(data["id"]) == user2["user_id"], "Expected user2s screen_name to appear in response"
def auth1(): user = UserKeys().user1() consumer = oauth2.Consumer(key=user["CONSUMER_KEY"], secret=user["CONSUMER_SECRET"]) access_token = oauth2.Token(key=user["ACCESS_KEY"], secret=user["ACCESS_SECRET"]) client = oauth2.Client(consumer, access_token) return client
def test_create_follow_self_user_id(auth1,user_info, create_friend): user1 = UserKeys().user1() data = create_friend(auth1, user_id=user1["user_id"]) assert "errors" in data assert data["errors"][0]["message"] == "You can't follow yourself."