def test_get_sso_backend(self): # test that we get the real one self.assertEqual(type(get_sso_backend(None, None, None)), LoginBackendDbusSSO) # test that we get the fake one os.environ["SOFTWARE_CENTER_FAKE_REVIEW_API"] = "1" self.assertEqual(type(get_sso_backend(None, None, None)), LoginBackendDbusSSOFake) # clean the environment del os.environ["SOFTWARE_CENTER_FAKE_REVIEW_API"]
def get_oauth_token_sync(self): self.oauth = None sso = get_sso_backend(self.xid, SOFTWARE_CENTER_NAME_KEYRING, _(SOFTWARE_CENTER_SSO_DESCRIPTION)) sso.connect("login-successful", self._login_successful) sso.connect("login-failed", lambda s: self.loop.quit()) sso.connect("login-canceled", lambda s: self.loop.quit()) sso.login_or_register() self.loop.run() return self.oauth
def _try_login(self): '''Try to get the credential or login on ubuntu sso''' logging.debug("OneConf login()") help_text = _("With multiple Ubuntu computers, you can publish their inventories online to compare the software installed on each\n" "No-one else will be able to see what you have installed.") self.sso = get_sso_backend(0, self.appname, help_text) self.sso.connect("login-successful", self._maybe_login_successful) self.sso.connect("login-canceled", self._login_canceled) self.sso.login_or_register()
def _try_login(self): '''Try to get the credential or login on ubuntu sso''' logging.debug("OneConf login()") help_text = _( "With multiple Ubuntu computers, you can publish their inventories online to compare the software installed on each\n" "No-one else will be able to see what you have installed.") self.sso = get_sso_backend(0, self.appname, help_text) self.sso.connect("login-successful", self._maybe_login_successful) self.sso.connect("login-canceled", self._login_canceled) self.sso.login_or_register()
def get_oauth_token_sync(self): self.oauth = None sso = get_sso_backend( self.xid, SOFTWARE_CENTER_NAME_KEYRING, _(SOFTWARE_CENTER_SSO_DESCRIPTION)) sso.connect("login-successful", self._login_successful) sso.connect("login-failed", lambda s: self.loop.quit()) sso.connect("login-canceled", lambda s: self.loop.quit()) sso.login_or_register() self.loop.run() return self.oauth
def _try_sso_login(self): # display the SSO login dialog if needed # FIXME: consider improving the text in the SSO dialog, for now # we simply reuse the opt-in text from the panel since we # are well past string freeze self.spinner_notebook.show_spinner() self.sso = get_sso_backend(get_parent_xid(self), SOFTWARE_CENTER_NAME_KEYRING, self.RECOMMENDATIONS_OPT_IN_TEXT) self.sso.connect("login-successful", self._maybe_login_successful) self.sso.connect("login-failed", self._login_failed) self.sso.connect("login-canceled", self._login_canceled) self.sso.login_or_register()