'creates auth token for users'

def prepare_auth_token(self, user):

    app_client = Client.objects.create(user=user, name='test    client', url='http://localhost//', redirect_uri='http://localhost//', client_type=CONFIDENTIAL)
    app_grant = Grant.objects.create(user=user, client=app_client, redirect_uri='http://localhost//')
    app_client_oauth2_provider = dot_models.Application.objects.create(name='test    client    2', user=user, client_type='confidential', authorization_grant_type='authorization-code', redirect_uris='http://localhost:8079/complete/edxorg/')
    auth_oauth2_provider = dot_models.AccessToken.objects.create(user=user, application=app_client_oauth2_provider, expires=(datetime.utcnow() + timedelta(weeks=1)), scope='read    write', token='16MGyP3OaQYHmpT1lK7Q6MMNAZsjwF')
    auth_header_oauth2_provider = 'Bearer    {0}'.format(auth_oauth2_provider)
    auth = self.get_auth_token(app_grant, app_client)
    return (auth, auth_header_oauth2_provider)
