Ejemplo n.º 1
0
    def test_remove_friendship__no_requests(self):
        with self.check_no_messages(self.account_2.id):
            with self.check_no_messages(self.account_1.id):
                FriendshipPrototype.remove_friendship(self.account_1,
                                                      self.account_2)

        self.assertEqual(Friendship.objects.all().count(), 0)
Ejemplo n.º 2
0
    def test_remove_friendship__his_request_exists(self):
        with self.check_new_message(self.account_2.id, [accounts_logic.get_system_user_id()]):
            with self.check_new_message(self.account_1.id, [self.account_2.id]):
                FriendshipPrototype.request_friendship(self.account_2, self.account_1, 'text 1')
                FriendshipPrototype.remove_friendship(self.account_1, self.account_2)

        self.assertEqual(Friendship.objects.all().count(), 0)
Ejemplo n.º 3
0
 def test_remove_friendship__his_request_exists(self):
     FriendshipPrototype.request_friendship(self.account_2, self.account_1,
                                            'text 1')
     FriendshipPrototype.remove_friendship(self.account_1, self.account_2)
     self.assertEqual(Friendship.objects.all().count(), 0)
     self.assertEqual(Message.objects.all().count(), 2)
     self.assertEqual(Message.objects.all().order_by('id')[1].recipient_id,
                      self.account_2.id)
Ejemplo n.º 4
0
 def test_remove_friendship__own_request_exists(self):
     with self.check_new_message(
             self.account_2.id,
         [accounts_logic.get_system_user_id(), self.account_1.id],
             number=2):
         FriendshipPrototype.request_friendship(self.account_1,
                                                self.account_2, 'text 1')
         FriendshipPrototype.remove_friendship(self.account_1,
                                               self.account_2)
Ejemplo n.º 5
0
 def remove(self, friend):
     FriendshipPrototype.remove_friendship(self.account, friend)
     return self.json_ok()
Ejemplo n.º 6
0
 def remove(self, friend):
     FriendshipPrototype.remove_friendship(self.account, friend)
     return self.json_ok()
Ejemplo n.º 7
0
 def test_remove_friendship__no_requests(self):
     FriendshipPrototype.remove_friendship(self.account_1, self.account_2)
     self.assertEqual(Friendship.objects.all().count(), 0)
     self.assertEqual(Message.objects.all().count(), 0)
Ejemplo n.º 8
0
 def test_remove_friendship__no_requests(self):
     FriendshipPrototype.remove_friendship(self.account_1, self.account_2)
     self.assertEqual(Friendship.objects.all().count(), 0)
     self.assertEqual(Message.objects.all().count(), 0)
Ejemplo n.º 9
0
 def test_remove_friendship__his_request_exists(self):
     FriendshipPrototype.request_friendship(self.account_2, self.account_1, 'text 1')
     FriendshipPrototype.remove_friendship(self.account_1, self.account_2)
     self.assertEqual(Friendship.objects.all().count(), 0)
     self.assertEqual(Message.objects.all().count(), 2)
     self.assertEqual(Message.objects.all().order_by('id')[1].recipient_id, self.account_2.id)