try login from selenium

This commit is contained in:
Cayo Puigdefabregas 2021-02-10 20:27:53 +01:00
parent 824bc7f8cd
commit a6f829e66c
1 changed files with 7 additions and 0 deletions

View File

@ -94,6 +94,7 @@ class BaseLiveServerTestCase(AppDependencyMixin, LiveServerTestCase):
self.account = self.create_account(superuser=True) self.account = self.create_account(superuser=True)
def admin_login(self): def admin_login(self):
# Original option
session = SessionStore() session = SessionStore()
session[SESSION_KEY] = self.account.id session[SESSION_KEY] = self.account.id
session[BACKEND_SESSION_KEY] = settings.AUTHENTICATION_BACKENDS[0] session[BACKEND_SESSION_KEY] = settings.AUTHENTICATION_BACKENDS[0]
@ -106,6 +107,12 @@ class BaseLiveServerTestCase(AppDependencyMixin, LiveServerTestCase):
path='/', 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()
def rest_login(self): def rest_login(self):
self.rest.login(username=self.account.username, password=self.account_password) self.rest.login(username=self.account.username, password=self.account_password)