From 1f57cdb48df344a65702259daf44445529dca9b5 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 15 Feb 2021 21:09:40 +0100 Subject: [PATCH] modify session with selenium --- orchestra/utils/tests.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/orchestra/utils/tests.py b/orchestra/utils/tests.py index 36f8c036..bbb49826 100644 --- a/orchestra/utils/tests.py +++ b/orchestra/utils/tests.py @@ -95,23 +95,23 @@ class BaseLiveServerTestCase(AppDependencyMixin, LiveServerTestCase): def admin_login(self): # Original option - session = SessionStore() - session[SESSION_KEY] = self.account.id - session[BACKEND_SESSION_KEY] = settings.AUTHENTICATION_BACKENDS[0] - session.save() - ## to set a cookie we need to first visit the domain. - self.selenium.get(self.live_server_url + '/admin/') - self.selenium.add_cookie(dict( - name=settings.SESSION_COOKIE_NAME, - value=session.session_key, # - path='/', - )) + # session = SessionStore() + # session[SESSION_KEY] = self.account.id + # session[BACKEND_SESSION_KEY] = settings.AUTHENTICATION_BACKENDS[0] + # session.save() + # to set a cookie we need to first visit the domain. + # self.selenium.get(self.live_server_url + '/admin/') + # self.selenium.add_cookie(dict( + # name=settings.SESSION_COOKIE_NAME, + # value=session.session_key, + # path='/', + # )) # Selenium option - # self.selenium.get(self.live_server_url + '/admin/') - # self.selenium.find_element_by_id("id_username").send_keys(self.account.username) - # self.selenium.find_element_by_id("id_password").send_keys(self.account_password) - # self.selenium.find_element_by_css_selector("input[type='submit']").click() + self.selenium.get(self.live_server_url + '/admin/') + self.selenium.find_element_by_id("id_username").send_keys(self.account.username) + self.selenium.find_element_by_id("id_password").send_keys(self.account_password) + self.selenium.find_element_by_css_selector("input[type='submit']").click() def rest_login(self): self.rest.login(username=self.account.username, password=self.account_password)