def test_focus(self):
        """
        Make sure that the site and user fields are disabled when doing session renewal
        """
        # Import locally since login_dialog has a dependency on Qt and it might be missing
        from tank.authentication import login_dialog
        ld = login_dialog.LoginDialog(is_session_renewal=False)
        self.assertEqual(ld.ui.site.text(), "")
        ld.close()

        ld = login_dialog.LoginDialog(is_session_renewal=False, login="******")
        self.assertEqual(ld.ui.site.text(), "")
        ld.close()

        ld = login_dialog.LoginDialog(is_session_renewal=False,
                                      hostname="host")
        self._prepare_window(ld)
        # window needs to be activated to get focus.
        self.assertTrue(ld.ui.login.hasFocus())
        ld.close()

        ld = login_dialog.LoginDialog(is_session_renewal=False,
                                      hostname="host",
                                      login="******")
        self._prepare_window(ld)
        self.assertTrue(ld.ui.password.hasFocus())
        ld.close()
 def _login_dialog(self, is_session_renewal, login=None, hostname=None):
     # Import locally since login_dialog has a dependency on Qt and it might be missing
     from tank.authentication import login_dialog
     with contextlib.closing(login_dialog.LoginDialog(is_session_renewal=is_session_renewal)) as ld:
         # SSO module and threading causes issues with unit tests, so disable it.
         ld._saml2_sso = None
         self._prepare_window(ld)
         yield ld
 def test_site_and_user_disabled_on_session_renewal(self):
     """
     Make sure that the site and user fields are disabled when doing session renewal
     """
     # Import locally since login_dialog has a dependency on Qt and it might be missing
     from tank.authentication import login_dialog
     ld = login_dialog.LoginDialog(is_session_renewal=True)
     self.assertTrue(ld.ui.site.isReadOnly())
     self.assertTrue(ld.ui.login.isReadOnly())
예제 #4
0
    def _login_dialog(self, is_session_renewal, login=None, hostname=None):
        # Import locally since login_dialog has a dependency on Qt and it might be missing
        from tank.authentication import login_dialog

        # Patch out the SsoSaml2Toolkit class to avoid threads being created, which cause
        # issues with tests.
        with patch("tank.authentication.login_dialog.SsoSaml2Toolkit"):
            with contextlib.closing(
                    login_dialog.LoginDialog(
                        is_session_renewal=is_session_renewal)) as ld:
                self._prepare_window(ld)
                yield ld