From 99a9d6ada7951d489cd5293cda7e4ae1b8febc2d Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 1 Feb 2017 10:52:52 +0200
Subject: [PATCH] - Added TLS 1.2 test.

---
 tests/test_sni.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/test_sni.py b/tests/test_sni.py
index b5daefd..e0632b7 100644
--- a/tests/test_sni.py
+++ b/tests/test_sni.py
@@ -4,8 +4,15 @@ from testinfra.utils.ansible_runner import AnsibleRunner
 testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
 
 
-@pytest.mark.parametrize('error', ['InsecureRequestWarning',
-                                   'InsecurePlatformWarning',
-                                   'SNIMissingWarning'])
+@pytest.mark.parametrize('error', [
+    'InsecureRequestWarning', 'InsecurePlatformWarning', 'SNIMissingWarning'
+])
 def test_sni(Command, error):
-    assert error not in Command('pip install nonexistant-package').stderr
+    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()
-- 
GitLab