|
rdobuilder |
23dcc2 |
--- a/dev-requirements.txt
|
|
rdobuilder |
23dcc2 |
+++ b/dev-requirements.txt
|
|
rdobuilder |
23dcc2 |
@@ -2,7 +2,6 @@
|
|
rdobuilder |
23dcc2 |
invoke==1.6.0
|
|
rdobuilder |
23dcc2 |
invocations==2.3.0
|
|
rdobuilder |
23dcc2 |
pytest==4.4.2
|
|
rdobuilder |
23dcc2 |
-pytest-relaxed==1.1.5
|
|
rdobuilder |
23dcc2 |
# pytest-xdist for test dir watching and the inv guard task
|
|
rdobuilder |
23dcc2 |
pytest-xdist==1.28.0
|
|
rdobuilder |
23dcc2 |
mock==2.0.0
|
|
rdobuilder |
23dcc2 |
--- a/pytest.ini
|
|
rdobuilder |
23dcc2 |
+++ b/pytest.ini
|
|
rdobuilder |
23dcc2 |
@@ -1,7 +1,4 @@
|
|
rdobuilder |
23dcc2 |
[pytest]
|
|
rdobuilder |
23dcc2 |
-# We use pytest-relaxed just for its utils at the moment, so disable it at the
|
|
rdobuilder |
23dcc2 |
-# plugin level until we adapt test organization to really use it.
|
|
rdobuilder |
23dcc2 |
-addopts = -p no:relaxed
|
|
rdobuilder |
23dcc2 |
# Loop on failure
|
|
rdobuilder |
23dcc2 |
looponfailroots = tests paramiko
|
|
rdobuilder |
23dcc2 |
# Ignore some warnings we cannot easily handle.
|
|
rdobuilder |
23dcc2 |
--- a/tests/test_client.py
|
|
rdobuilder |
23dcc2 |
+++ b/tests/test_client.py
|
|
rdobuilder |
23dcc2 |
@@ -33,7 +33,7 @@ import warnings
|
|
rdobuilder |
23dcc2 |
import weakref
|
|
rdobuilder |
23dcc2 |
from tempfile import mkstemp
|
|
rdobuilder |
23dcc2 |
|
|
rdobuilder |
23dcc2 |
-from pytest_relaxed import raises
|
|
rdobuilder |
23dcc2 |
+import pytest
|
|
rdobuilder |
23dcc2 |
from mock import patch, Mock
|
|
rdobuilder |
23dcc2 |
|
|
rdobuilder |
23dcc2 |
import paramiko
|
|
rdobuilder |
23dcc2 |
@@ -687,10 +687,10 @@ class PasswordPassphraseTests(ClientTest
|
|
rdobuilder |
23dcc2 |
|
|
rdobuilder |
23dcc2 |
# TODO: more granular exception pending #387; should be signaling "no auth
|
|
rdobuilder |
23dcc2 |
# methods available" because no key and no password
|
|
rdobuilder |
23dcc2 |
- @raises(SSHException)
|
|
rdobuilder |
23dcc2 |
def test_passphrase_kwarg_not_used_for_password_auth(self):
|
|
rdobuilder |
23dcc2 |
- # Using the "right" password in the "wrong" field shouldn't work.
|
|
rdobuilder |
23dcc2 |
- self._test_connection(passphrase="pygmalion")
|
|
rdobuilder |
23dcc2 |
+ with pytest.raises(SSHException):
|
|
rdobuilder |
23dcc2 |
+ # Using the "right" password in the "wrong" field shouldn't work.
|
|
rdobuilder |
23dcc2 |
+ self._test_connection(passphrase="pygmalion")
|
|
rdobuilder |
23dcc2 |
|
|
rdobuilder |
23dcc2 |
def test_passphrase_kwarg_used_for_key_passphrase(self):
|
|
rdobuilder |
23dcc2 |
# Straightforward again, with new passphrase kwarg.
|
|
rdobuilder |
23dcc2 |
@@ -708,14 +708,14 @@ class PasswordPassphraseTests(ClientTest
|
|
rdobuilder |
23dcc2 |
password="television",
|
|
rdobuilder |
23dcc2 |
)
|
|
rdobuilder |
23dcc2 |
|
|
rdobuilder |
23dcc2 |
- @raises(AuthenticationException) # TODO: more granular
|
|
rdobuilder |
23dcc2 |
def test_password_kwarg_not_used_for_passphrase_when_passphrase_kwarg_given( # noqa
|
|
rdobuilder |
23dcc2 |
self
|
|
rdobuilder |
23dcc2 |
):
|
|
rdobuilder |
23dcc2 |
# Sanity: if we're given both fields, the password field is NOT used as
|
|
rdobuilder |
23dcc2 |
# a passphrase.
|
|
rdobuilder |
23dcc2 |
- self._test_connection(
|
|
rdobuilder |
23dcc2 |
- key_filename=_support("test_rsa_password.key"),
|
|
rdobuilder |
23dcc2 |
- password="television",
|
|
rdobuilder |
23dcc2 |
- passphrase="wat? lol no",
|
|
rdobuilder |
23dcc2 |
- )
|
|
rdobuilder |
23dcc2 |
+ with pytest.raises(AuthenticationException):
|
|
rdobuilder |
23dcc2 |
+ self._test_connection(
|
|
rdobuilder |
23dcc2 |
+ key_filename=_support("test_rsa_password.key"),
|
|
rdobuilder |
23dcc2 |
+ password="television",
|
|
rdobuilder |
23dcc2 |
+ passphrase="wat? lol no",
|
|
rdobuilder |
23dcc2 |
+ )
|