def test_get_friends(self): actions.friend_request(self.sender.key.id(), self.reciever.key.id()) actions.respond_to_friend_request(self.reciever.key.id(), self.sender.key.id(), True) relation = actions.get_relationship(self.sender, self.reciever) assert relation.is_friends == True
def test_send_friend_request_after_already_recieved(self): actions.friend_request(self.reciever.key.id(), self.sender.key.id()) actions.friend_request(self.sender.key.id(), self.reciever.key.id()) relation = models.Relationship.get_by_users(self.sender, self.reciever) assert relation is not None assert relation.is_friends == True
def test_created_friend_request(self): actions.friend_request(self.sender.key.id(), self.reciever.key.id()) relation = models.Relationship.get_by_users(self.sender, self.reciever) assert relation is not None assert relation.friend_request_sent == True
def test_reject_friend_request(self): actions.friend_request(self.sender.key.id(), self.reciever.key.id()) actions.respond_to_friend_request(self.reciever.key.id(), self.sender.key.id(), False) relation = models.Relationship.get_by_users(self.sender, self.reciever) assert not relation.is_friends assert relation.friend_request_rejected
def test_accept_friend_request(self): actions.friend_request(self.sender.key.id(), self.reciever.key.id()) actions.respond_to_friend_request(self.reciever.key.id(), self.sender.key.id(), True) relation = models.Relationship.get_by_users(self.sender, self.reciever) assert relation.is_friends == True assert not relation.friend_request_rejected self.assert_in_friends_list()
def test_friends(self): actions.friend_request(self.sender.key.id(), self.reciever.key.id()) actions.respond_to_friend_request(self.reciever.key.id(), self.sender.key.id(), True) self.assert_in_friends_list() relationship = actions.unfriend(self.sender.key.id(), self.reciever.key.id()) assert relationship.key.kind() == "Relationship" self.assert_not_in_friends_list() assert relationship.is_friends == False assert relationship.friend_unfriender == self.sender.key
def friend_request(self, request): """Send a friend request.""" auth_user = actions.verify_and_get_user(token=request.token) relationship = actions.friend_request(auth_user.key.id(), request.user) msg = mmglue.message_from_model(relationship, messages.Relationship) msg.users = [k.id() for k in relationship.users] return msg
def respond_to_friend_request(self): actions.friend_request(76576533, 8768665, False)
def test_fail_on_unknown_users(self): actions.friend_request(76576533, 8768665)