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)
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)
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)
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)
def remove(self, friend): FriendshipPrototype.remove_friendship(self.account, friend) return self.json_ok()
def remove(self, friend): FriendshipPrototype.remove_friendship(self.account, friend) return self.json_ok()
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)
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)
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)