diff options
author | drebs <drebs@leap.se> | 2012-12-24 10:14:58 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2012-12-24 10:14:58 -0200 |
commit | 319e279b59ac080779d0a3375ae4d6582f5ee6a3 (patch) | |
tree | 118dd0f495c0d54f2b2c66ea235e4e4e6b8cefd5 /src/leap/gui/firstrun/tests/integration | |
parent | ca5fb41a55e1292005ed186baf3710831d9ad678 (diff) | |
parent | a7b091a0553e6120f3e0eb6d4e73a89732c589b2 (diff) |
Merge branch 'develop' of ssh://code.leap.se/leap_client into develop
Diffstat (limited to 'src/leap/gui/firstrun/tests/integration')
-rwxr-xr-x | src/leap/gui/firstrun/tests/integration/fake_provider.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/leap/gui/firstrun/tests/integration/fake_provider.py b/src/leap/gui/firstrun/tests/integration/fake_provider.py index 33ee0ee6..445b4487 100755 --- a/src/leap/gui/firstrun/tests/integration/fake_provider.py +++ b/src/leap/gui/firstrun/tests/integration/fake_provider.py @@ -40,6 +40,8 @@ from twisted.web.static import File from twisted.web.resource import Resource from twisted.internet import reactor +from leap.testing.https_server import where + # See # http://twistedmatrix.com/documents/current/web/howto/web-in-60/index.htmln # for more examples @@ -229,14 +231,13 @@ def get_certs_path(): def get_TLS_credentials(): # XXX this is giving errors # XXX REview! We want to use gnutls! - certs_path = get_certs_path() cert = crypto.X509Certificate( - open(certs_path + '/leaptestscert.pem').read()) + open(where('leaptestscert.pem')).read()) key = crypto.X509PrivateKey( - open(certs_path + '/leaptestskey.pem').read()) + open(where('leaptestskey.pem')).read()) ca = crypto.X509Certificate( - open(certs_path + '/cacert.pem').read()) + open(where('cacert.pem')).read()) #crl = crypto.X509CRL(open(certs_path + '/crl.pem').read()) #cred = crypto.X509Credentials(cert, key, [ca], [crl]) cred = X509Credentials(cert, key, [ca]) @@ -253,19 +254,17 @@ class OpenSSLServerContextFactory: """Create an SSL context. This is a sample implementation that loads a certificate from a file called 'server.pem'.""" - certs_path = get_certs_path() ctx = SSL.Context(SSL.SSLv23_METHOD) - ctx.use_certificate_file(certs_path + '/leaptestscert.pem') - ctx.use_privatekey_file(certs_path + '/leaptestskey.pem') + #certs_path = get_certs_path() + #ctx.use_certificate_file(certs_path + '/leaptestscert.pem') + #ctx.use_privatekey_file(certs_path + '/leaptestskey.pem') + ctx.use_certificate_file(where('leaptestscert.pem')) + ctx.use_privatekey_file(where('leaptestskey.pem')) return ctx -if __name__ == "__main__": - - from twisted.python import log - log.startLogging(sys.stdout) - +def serve_fake_provider(): root = Resource() root.putChild("provider.json", File("./provider.json")) config = Resource() @@ -293,3 +292,11 @@ if __name__ == "__main__": reactor.listenSSL(8443, factory, OpenSSLServerContextFactory()) reactor.run() + + +if __name__ == "__main__": + + from twisted.python import log + log.startLogging(sys.stdout) + + serve_fake_provider() |