From fafd39f2f3728173a1b6f09dfd3ad309108f1ccb Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sun, 5 Feb 2017 08:20:01 +0200 Subject: [PATCH] - Moved TLS 1.2 test to a different file, use urllib instead of requests because requests is not installed by default (only when working around SNI issues). --- tests/test_sni.py | 7 ------- tests/test_tls12.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 tests/test_tls12.py diff --git a/tests/test_sni.py b/tests/test_sni.py index e0632b7..1885e2a 100644 --- a/tests/test_sni.py +++ b/tests/test_sni.py @@ -9,10 +9,3 @@ testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') ]) def test_sni(Command, error): assert error not in Command('pip2 install nonexistant-package').stderr - - -def test_tls12(Command): - pycommand = '''import requests; -print(requests.get('https://www.howsmyssl.com/a/check', -verify=False).json()['tls_version'])''' - assert 'TLS 1.2' == Command('python2 -c \"%s\"' % pycommand).stdout.strip() diff --git a/tests/test_tls12.py b/tests/test_tls12.py new file mode 100644 index 0000000..2760610 --- /dev/null +++ b/tests/test_tls12.py @@ -0,0 +1,10 @@ +from testinfra.utils.ansible_runner import AnsibleRunner + +testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') + + +def test_tls12(Command): + pycommand = '''import urllib2, json +print(json.loads(urllib2.urlopen(urllib2.Request( +'https://www.howsmyssl.com/a/check')).read())['tls_version'])''' + assert 'TLS 1.2' == Command('python2 -c \"%s\"' % pycommand).stdout.strip() -- GitLab