From 6914202143b4a475132c918fbea5c11cb187552a Mon Sep 17 00:00:00 2001 From: Damien Degois Date: Tue, 9 Jan 2024 02:45:03 +0100 Subject: [PATCH] Fix tests --- tests/pytests/functional/modules/test_mongodb.py | 6 ++++-- tests/pytests/unit/states/test_mongodb_database.py | 6 ++++++ tests/pytests/unit/states/test_mongodb_user.py | 12 ++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/pytests/functional/modules/test_mongodb.py b/tests/pytests/functional/modules/test_mongodb.py index 5fb758da690..5711af4c791 100644 --- a/tests/pytests/functional/modules/test_mongodb.py +++ b/tests/pytests/functional/modules/test_mongodb.py @@ -111,7 +111,8 @@ def test_when_mongo_requires_tls_and_module_ssl_is_False_connection_should_fail( ssl=False, verify_ssl=False, ) - assert result == "Failed to connect to mongo database" + assert isinstance(result, str) + assert "connection closed" in result def test_when_mongo_requires_tls_and_module_ssl_is_True_connection_should_succeed( @@ -158,4 +159,5 @@ def test_when_mongo_not_requires_tls_and_module_ssl_is_True_connection_should_fa ssl=True, verify_ssl=False, ) - assert result == "Failed to connect to mongo database" + assert isinstance(result, str) + assert "SSL handshake failed" in result diff --git a/tests/pytests/unit/states/test_mongodb_database.py b/tests/pytests/unit/states/test_mongodb_database.py index f0eaf2ce00d..d79e18aa668 100644 --- a/tests/pytests/unit/states/test_mongodb_database.py +++ b/tests/pytests/unit/states/test_mongodb_database.py @@ -89,6 +89,9 @@ def test_when_mongodb_database_remove_is_called_it_should_correctly_pass_ssl_arg call( host="mongodb.example.net", port=1982, + username=None, + password=None, + authSource="admin", ssl=expected_ssl, tlsAllowInvalidCertificates=expected_allow_invalid, ), @@ -102,6 +105,9 @@ def test_when_mongodb_database_remove_is_called_it_should_correctly_pass_ssl_arg call( host="mongodb.example.net", port=1982, + username=None, + password=None, + authSource="admin", ssl=expected_ssl, tlsAllowInvalidCertificates=expected_allow_invalid, ), diff --git a/tests/pytests/unit/states/test_mongodb_user.py b/tests/pytests/unit/states/test_mongodb_user.py index 6bd7d93896a..3a373dc9114 100644 --- a/tests/pytests/unit/states/test_mongodb_user.py +++ b/tests/pytests/unit/states/test_mongodb_user.py @@ -131,6 +131,9 @@ def test_when_absent_is_called_it_should_pass_the_correct_ssl_argument_to_MongoC call( host="example.com", port=42, + username=None, + password=None, + authSource="admin", ssl=expected_ssl, tlsAllowInvalidCertificates=expected_allow_invalid, ), @@ -138,6 +141,9 @@ def test_when_absent_is_called_it_should_pass_the_correct_ssl_argument_to_MongoC call( host="example.com", port=42, + username=None, + password=None, + authSource="admin", ssl=expected_ssl, tlsAllowInvalidCertificates=expected_allow_invalid, ), @@ -179,6 +185,9 @@ def test_when_present_is_called_it_should_pass_the_correct_ssl_argument_to_Mongo call( host="example.com", port=42, + username=None, + password=None, + authSource="admin", ssl=expected_ssl, tlsAllowInvalidCertificates=expected_allow_invalid, ), @@ -186,6 +195,9 @@ def test_when_present_is_called_it_should_pass_the_correct_ssl_argument_to_Mongo call( host="example.com", port=42, + username=None, + password=None, + authSource="admin", ssl=expected_ssl, tlsAllowInvalidCertificates=expected_allow_invalid, ),