@pytest.fixture()
def admin_client(admin_user):
 from django.test.client import Client
 client = Client()
 client.login(username=admin_user.email, password=u'password')
 return client

@ pytest . fixture ( ) def admin_client ( admin_user ) : from django . test . client import Client client = Client ( ) client . login ( username = admin_user . email , password = u'password' ) return client
a django test client logged in as an admin user .