コード例 #1
0
    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
コード例 #2
0
    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
コード例 #3
0
    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
コード例 #4
0
    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
コード例 #5
0
    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()
コード例 #6
0
    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
コード例 #7
0
    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
コード例 #8
0
 def respond_to_friend_request(self):
     actions.friend_request(76576533, 8768665, False)
コード例 #9
0
 def test_fail_on_unknown_users(self):
     actions.friend_request(76576533, 8768665)