class LogistrationMixin(StudioUserMixin): def setUp(self): super(LogistrationMixin, self).setUp() self.studio_login_page = StudioLoginPage(self.browser) def login(self, is_staff=True): if STUDIO_EMAIL and STUDIO_PASSWORD: # If the credential is specified through config, always use the specified credentials self.login_with_studio(STUDIO_EMAIL, STUDIO_PASSWORD) elif LMS_AUTO_AUTH: # Only use auto auth if the config allows it _, password, email = self.create_studio_user(is_staff) self.login_with_studio(email, password) else: raise RuntimeError( 'User credentials have not been provided, and auto auth is not enabled.') def login_with_studio(self, email, password): # Note: We use Selenium directly here (as opposed to bok-choy) to avoid issues with promises being broken. self.studio_login_page.browser.get(self.studio_login_page.url) self.studio_login_page.login(email, password)
class LogistrationMixin(StudioUserMixin): def setUp(self): super(LogistrationMixin, self).setUp() self.studio_login_page = StudioLoginPage(self.browser) def login(self, is_staff=True): if STUDIO_EMAIL and STUDIO_PASSWORD: # If the credential is specified through config, always use the specified credentials self.login_with_studio(STUDIO_EMAIL, STUDIO_PASSWORD) elif LMS_AUTO_AUTH: # Only use auto auth if the config allows it _, password, email = self.create_studio_user(is_staff) self.login_with_studio(email, password) else: raise RuntimeError( 'User credentials have not been provided, and auto auth is not enabled.' ) def login_with_studio(self, email, password): # Note: We use Selenium directly here (as opposed to bok-choy) to avoid issues with promises being broken. self.studio_login_page.browser.get(self.studio_login_page.url) self.studio_login_page.login(email, password)
def setUp(self): super(LogistrationMixin, self).setUp() self.studio_login_page = StudioLoginPage(self.browser)