-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP; Hide inactive users from the blog post author dropdown
- Loading branch information
1 parent
303a31b
commit 24d6fc9
Showing
2 changed files
with
17 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from . import HermesTestCase | ||
from .. import settings | ||
from hermes import models | ||
from django.contrib.auth.models import User | ||
|
||
|
||
class PostTestCase(HermesTestCase): | ||
|
@@ -232,3 +233,16 @@ def test_published(self): | |
self.post1, | ||
] | ||
self.assertEqual(expected, list(models.Post.objects.published())) | ||
|
||
def test_active_users_only(self): | ||
"""The UserQuerySet should only return active users""" | ||
author_6 = User.objects.create( | ||
username="eleven", | ||
email="[email protected]", | ||
first_name="Jane", | ||
last_name="Hopper", | ||
is_staff=False, | ||
is_active=False, | ||
) | ||
expected = [author_6] | ||
self.assertNotEqual(expected, list(User.objects.filter(is_active=True))) |