-
-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small code improvements in category/user deletion tests
- Loading branch information
Showing
1 changed file
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,16 +209,26 @@ def test_mass_delete_accounts_superadmin(self): | |
|
||
def test_mass_delete_accounts(self): | ||
"""users list deletes users""" | ||
# create 10 users to delete | ||
user_pks = [] | ||
for i in range(10): | ||
test_user = UserModel.objects.create_user( | ||
'Bob%s' % i, | ||
'bob%[email protected]' % i, | ||
'pass123', | ||
requires_activation=1, | ||
requires_activation=0, | ||
) | ||
user_pks.append(test_user.pk) | ||
|
||
# create 10 more users that won't be deleted | ||
for i in range(10): | ||
test_user = UserModel.objects.create_user( | ||
'Weebl%s' % i, | ||
'weebl%[email protected]' % i, | ||
'pass123', | ||
requires_activation=0, | ||
) | ||
|
||
response = self.client.post( | ||
reverse('misago:admin:users:accounts:index'), | ||
data={ | ||
|
@@ -227,7 +237,7 @@ def test_mass_delete_accounts(self): | |
} | ||
) | ||
self.assertEqual(response.status_code, 302) | ||
self.assertEqual(UserModel.objects.count(), 1) | ||
self.assertEqual(UserModel.objects.count(), 11) | ||
|
||
def test_mass_delete_all_self(self): | ||
"""its impossible to delete oneself with content""" | ||
|
@@ -304,7 +314,7 @@ def test_mass_delete_all_superadmin(self): | |
self.assertEqual(UserModel.objects.count(), 11) | ||
|
||
def test_mass_delete_all(self): | ||
"""users list deletes users and their content""" | ||
"""users list mass deleting view has no showstoppers""" | ||
user_pks = [] | ||
for i in range(10): | ||
test_user = UserModel.objects.create_user( | ||
|
@@ -323,7 +333,9 @@ def test_mass_delete_all(self): | |
} | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual(UserModel.objects.count(), 11) # no user has been deleted | ||
# asser that no user has been deleted, because actuall deleting happens in | ||
# dedicated views called via ajax from JavaScript | ||
self.assertEqual(UserModel.objects.count(), 11) | ||
|
||
def test_new_view(self): | ||
"""new user view creates account""" | ||
|