def _x509(): voms_proxy = MyProxyClient() x509 = voms_proxy.get() if os.access(x509, os.R_OK): logger.debug("x509 = %s" % x509) return x509 logger.warning("No valid grid proxy certificate found") return ""
class SecurityTest(TestCase): def setUp(self): self.voms_proxy = MyProxyClient() self.sso_test_url = 'https://espace.cern.ch/authentication/default.aspx' def test_cern_sso(self): try: sso_cookies = SSOCookies(self.sso_test_url, krb=True, use_cached=False) except Exception as ex: print "test_cern_sso, exception occurred (1): %s" % str(ex) sso_cookies = None self.assertNotEqual(sso_cookies, None) result = requests.get(self.sso_test_url, cookies=sso_cookies.get(), verify=False) self.assertEqual(result.status_code, 200) try: cached_sso_cookies = SSOCookies(self.sso_test_url, krb=True, use_cached=True) except Exception as ex: print "test_cern_sso, exception occurred (2): %s" % str(ex) cached_sso_cookies = None self.assertNotEqual(cached_sso_cookies, None) self.assertEqual(cached_sso_cookies.get(), sso_cookies.get()) result = requests.get(self.sso_test_url, cookies=cached_sso_cookies.get(), verify=False) self.assertEqual(result.status_code, 200) def test_voms(self): try: proxy_file_path = self.voms_proxy.get() except Exception as ex: print "test_voms, exception occurred: %s" % str(ex) proxy_file_path = None self.assertNotEqual(proxy_file_path, None) self.voms_proxy.remove()
def setUp(self): self.voms_proxy = MyProxyClient() self.sso_test_url = 'https://espace.cern.ch/authentication/default.aspx'