Skip to content

Commit

Permalink
set current user for user directory
Browse files Browse the repository at this point in the history
  • Loading branch information
danlipert committed Jun 12, 2019
1 parent 3fd1a63 commit fce4ea1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/dashboard/tests/test_users_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ class UsersListTest(TestCase):

def setUp(self):
self.request = RequestFactory()
self.current_user = User.objects.create(
password="asdfasdf", username="asdfasdf")
current_user_profile = Profile.objects.create(
user=self.current_user, data={}, hide_profile=False, handle="asdfasdf")

for i in range(20):
user = User.objects.create(password="{}".format(i),
username="user{}".format(i))
profile = Profile.objects.create(
user=user, data={}, hide_profile=False, handle="{}".format(i))

def test_user_list(self):
assert json.loads(users_fetch(self.request.get('/api/v0.1/users_fetch/')).content)['count'] == 20
request = self.request
request.user = self.current_user
assert json.loads(users_fetch(request.get('/api/v0.1/users_fetch/')).content)['count'] == 21

0 comments on commit fce4ea1

Please sign in to comment.