|
21 | 21 | # this test works WITHOUT an online TestLink Server
|
22 | 22 | # no calls are send to a TestLink Server
|
23 | 23 |
|
24 |
| -import pytest |
| 24 | +import pytest, sys |
| 25 | +IS_PY3 = sys.version_info[0] > 2 |
25 | 26 |
|
26 | 27 | class DummyTestLinkAPI(object):
|
27 | 28 | """ Dummy for Simulation TestLinkAPICLient.
|
@@ -140,22 +141,50 @@ def test_connect(api_helper_class):
|
140 | 141 | assert 'DEVKEY-51' == a_tl_api.devKey
|
141 | 142 | assert {} == a_tl_api.args
|
142 | 143 |
|
143 |
| -def test_getProxiedTransport(api_helper_class): |
144 |
| - """ create a ProxiedTransportTestLink API dummy """ |
145 |
| - a_helper = api_helper_class('SERVER-URL-61', 'DEVKEY-61', 'PROXY-61') |
| 144 | +def test_getProxiedTransport_py2(api_helper_class): |
| 145 | + """ create a TestLink Helper with ProxiedTransport - py27 """ |
| 146 | + if IS_PY3: |
| 147 | + pytest.skip("py27 specific test") |
| 148 | + |
| 149 | + a_helper = api_helper_class('SERVER-URL-611', 'DEVKEY-611', 'PROXY-611:8080') |
146 | 150 | #'http://fast.proxy.com.de/')
|
147 | 151 | a_pt = a_helper._getProxiedTransport()
|
148 | 152 | assert 'ProxiedTransport' == a_pt.__class__.__name__
|
149 |
| - assert 'PROXY-61' == a_pt.proxy |
| 153 | + assert 'PROXY-611:8080' == a_pt.proxy |
150 | 154 |
|
| 155 | +def test_getProxiedTransport_py3(api_helper_class): |
| 156 | + """ create a TestLink Helper with ProxiedTransport - py3x """ |
| 157 | + |
| 158 | + if not IS_PY3: |
| 159 | + pytest.skip("py3 specific test") |
| 160 | + |
| 161 | + a_helper = api_helper_class('SERVER-URL-612', 'DEVKEY-612', 'http://PROXY-612:8080') |
| 162 | + #'http://fast.proxy.com.de/') |
| 163 | + a_pt = a_helper._getProxiedTransport() |
| 164 | + assert 'ProxiedTransport' == a_pt.__class__.__name__ |
| 165 | + assert ('http://proxy-612', 8080) == a_pt.proxy |
151 | 166 |
|
152 |
| -def test_connect_with_proxy(api_helper_class): |
153 |
| - """ create a TestLink API dummy with ProxiedTransport""" |
154 |
| - a_helper = api_helper_class('SERVER-URL-71', 'DEVKEY-71', 'PROXY-71') |
| 167 | +def test_connect_with_proxy2(api_helper_class): |
| 168 | + """ create a TestLink API dummy with ProxiedTransport - py27""" |
| 169 | + if IS_PY3: |
| 170 | + pytest.skip("py27 specific test") |
| 171 | + |
| 172 | + a_helper = api_helper_class('SERVER-URL-711', 'DEVKEY-711', 'PROXY-71:8080') |
155 | 173 | a_tl_api = a_helper.connect(DummyTestLinkAPI)
|
156 |
| - assert 'SERVER-URL-71' == a_tl_api.server |
157 |
| - assert 'DEVKEY-71' == a_tl_api.devKey |
158 |
| - assert 'PROXY-71' == a_tl_api.args['transport'].proxy |
| 174 | + assert 'SERVER-URL-711' == a_tl_api.server |
| 175 | + assert 'DEVKEY-711' == a_tl_api.devKey |
| 176 | + assert 'PROXY-711' == a_tl_api.args['transport'].proxy |
| 177 | + |
| 178 | +def test_connect_with_proxy3(api_helper_class): |
| 179 | + """ create a TestLink API dummy with ProxiedTransport - py3x""" |
| 180 | + if not IS_PY3: |
| 181 | + pytest.skip("py3 specific test") |
| 182 | + |
| 183 | + a_helper = api_helper_class('SERVER-URL-712', 'DEVKEY-712', 'https://PROXY-712:8080') |
| 184 | + a_tl_api = a_helper.connect(DummyTestLinkAPI) |
| 185 | + assert 'SERVER-URL-712' == a_tl_api.server |
| 186 | + assert 'DEVKEY-712' == a_tl_api.devKey |
| 187 | + assert ('https://proxy-712', 8080) == a_tl_api.args['transport'].proxy |
159 | 188 |
|
160 | 189 | def test_connect_ignoring_proxy_env(api_helper_class, monkeypatch):
|
161 | 190 | """ create a TestLink API dummy ignoring PROXY env - pullRequest #121 """
|
|
0 commit comments