From b0bb1a0d6cd58320186bcbc043ca1cc098ecc668 Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Fri, 26 Apr 2019 12:58:06 +0200 Subject: [PATCH] Added testing code for https server --- .../features/steps/fixtures/httpd.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dnf-behave-tests/features/steps/fixtures/httpd.py b/dnf-behave-tests/features/steps/fixtures/httpd.py index 3d5bb0a9e..ce1dc72b0 100644 --- a/dnf-behave-tests/features/steps/fixtures/httpd.py +++ b/dnf-behave-tests/features/steps/fixtures/httpd.py @@ -95,3 +95,21 @@ def shutdown(self): """ for _, process in self.servers.values(): process.terminate() + + +if __name__ == '__main__': + import os + ctx = HttpServerContext() + certpath = '../../../fixtures/certificates/testcerts' + cacert = os.path.realpath(os.path.join(certpath, 'ca/cert.pem')) + host, port = ctx.new_https_server( + '../../../fixtures/repos/', + cacert, + os.path.realpath(os.path.join(certpath, 'server/cert.pem')), + os.path.realpath(os.path.join(certpath, 'server/key.pem')), + False) + curl = 'curl --cacert {} https://{}:{}/'.format(cacert, host, port) + #curl = 'wget --ca-certificate {} https://{}:{}/'.format(cacert, host, port) + print(curl) + print(os.system(curl)) + ctx.shutdown()