logged in api client

This commit is contained in:
Eliot Berriot 2018-02-20 23:59:50 +01:00
parent 953d0ddc91
commit 15bdf18705
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
1 changed files with 9 additions and 0 deletions

View File

@ -56,6 +56,15 @@ def api_client(client):
return APIClient()
@pytest.fixture
def logged_in_api_client(db, factories, api_client):
user = factories['users.User']()
assert api_client.login(username=user.username, password='test')
setattr(api_client, 'user', user)
yield api_client
delattr(api_client, 'user')
@pytest.fixture
def superuser_client(db, factories, client):
user = factories['users.SuperUser']()