test: Tests were failing due to different sorting order. (#29151)
This commit is contained in:
@@ -84,8 +84,9 @@ class BulkUserRetirementViewTests(APITestCase):
|
||||
response = self.client.post(user_retirement_url, {
|
||||
"usernames": f'{self.user3.username},{self.user4.username}'
|
||||
})
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.data == expected_response
|
||||
assert sorted(response.data['successful_user_retirements']) == sorted(expected_response['successful_user_retirements']) # pylint: disable=line-too-long
|
||||
|
||||
retirement_status_1 = UserRetirementStatus.objects.get(user__username=self.user3.username)
|
||||
assert retirement_status_1.current_state == self.pending_state
|
||||
@@ -99,6 +100,7 @@ class BulkUserRetirementViewTests(APITestCase):
|
||||
'successful_user_retirements': [self.user3.username, self.user4.username],
|
||||
'failed_user_retirements': ['non_existing_user']
|
||||
}
|
||||
|
||||
with self.settings(RETIREMENT_SERVICE_WORKER_USERNAME=self.user1.username):
|
||||
response = self.client.post(user_retirement_url, {
|
||||
"usernames": '{user1},{user2}, non_existing_user'.format(
|
||||
@@ -107,7 +109,8 @@ class BulkUserRetirementViewTests(APITestCase):
|
||||
)
|
||||
})
|
||||
assert response.status_code == 200
|
||||
assert response.data == expected_response
|
||||
|
||||
assert sorted(response.data['successful_user_retirements']) == sorted(expected_response['successful_user_retirements']) # pylint: disable=line-too-long
|
||||
|
||||
retirement_status_1 = UserRetirementStatus.objects.get(user__username=self.user3.username)
|
||||
assert retirement_status_1.current_state == self.pending_state
|
||||
|
||||
Reference in New Issue
Block a user