def user_is_logged_in(context): context.execute_steps(u''' when the user accesses the url "/" ''') u = User.objects.create(username='******', email=settings.TESTING_LOGIN_USER) u.set_password(settings.TESTING_LOGIN_PASSWORD) u.save() store = TaskStore.get_for_user(u) if not store.configured: store.autoconfigure_taskd() context.store = store meta = UserMetadata.get_for_user(u) meta.tos_version = settings.TOS_VERSION meta.tos_accepted = now() meta.save() cookies = artificial_login(username=u.username, password=settings.TESTING_LOGIN_PASSWORD) context.browser.cookies.add(cookies) context.execute_steps(u''' when the user accesses the url "/" then the page contains the heading "Let's get started" ''')
def user_is_logged_in(context): context.execute_steps(u''' when the user accesses the url "/" ''') u = User.objects.create( username='******', email=settings.TESTING_LOGIN_USER ) u.set_password(settings.TESTING_LOGIN_PASSWORD) u.save() store = TaskStore.get_for_user(u) if not store.configured: store.autoconfigure_taskd() context.store = store meta = UserMetadata.get_for_user(u) meta.tos_version = settings.TOS_VERSION meta.tos_accepted = now() meta.save() cookies = artificial_login( username=u.username, password=settings.TESTING_LOGIN_PASSWORD ) context.browser.cookies.add(cookies) context.execute_steps(u''' when the user accesses the url "/" then the page contains the heading "Let's get started" ''')
def debug_login(request): from inthe_am.taskmanager.debug_utils import artificial_login if not settings.DEBUG: raise SuspiciousOperation( "Artificial login attempted while not in debug mode!") try: cookies = artificial_login( username=request.GET['username'], password=request.GET['password'], ) except AttributeError: return HttpResponseBadRequest() response = HttpResponseRedirect('/') for name, value in cookies.items(): response.set_cookie(name, value) return response
def debug_login(request): from inthe_am.taskmanager.debug_utils import artificial_login if not settings.DEBUG: raise SuspiciousOperation( "Artificial login attempted while not in debug mode!" ) try: cookies = artificial_login( username=request.GET['username'], password=request.GET['password'], ) except AttributeError: return HttpResponseBadRequest() response = HttpResponseRedirect('/') for name, value in cookies.items(): response.set_cookie(name, value) return response