Skip to content

Commit

Permalink
Use the correct class in tests.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Oct 20, 2023
1 parent f8f2b62 commit ae1ebe1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test_opensearchpy/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def test_ssl_context(self):
# it means SSLContext is not available for that version of python
# and we should skip this test.
raise SkipTest(
"Test test_ssl_context is skipped cause SSLContext is not available for this version of ptyhon"
"Test test_ssl_context is skipped cause SSLContext is not available for this version of python"
)

con = Urllib3HttpConnection(use_ssl=True, ssl_context=context)
Expand Down Expand Up @@ -323,7 +323,7 @@ def test_http_auth_list(self):
)

@pytest.mark.skipif(
sys.version_info < (3, 6), reason="RequestsAWSV4SignerAuth requires python3.6+"
sys.version_info < (3, 6), reason="Urllib3AWSV4SignerAuth requires python3.6+"
)
def test_aws_signer_as_http_auth(self):
region = "us-west-2"
Expand All @@ -338,35 +338,35 @@ def test_aws_signer_as_http_auth(self):
self.assertIn("X-Amz-Content-SHA256", headers)

@pytest.mark.skipif(
sys.version_info < (3, 6), reason="RequestsAWSV4SignerAuth requires python3.6+"
sys.version_info < (3, 6), reason="Urllib3AWSV4SignerAuth requires python3.6+"
)
def test_aws_signer_when_region_is_null(self):
session = self.mock_session()

from opensearchpy.helpers.signer import RequestsAWSV4SignerAuth
from opensearchpy.helpers.signer import Urllib3AWSV4SignerAuth

with pytest.raises(ValueError) as e:
RequestsAWSV4SignerAuth(session, None)
Urllib3AWSV4SignerAuth(session, None)
assert str(e.value) == "Region cannot be empty"

with pytest.raises(ValueError) as e:
RequestsAWSV4SignerAuth(session, "")
Urllib3AWSV4SignerAuth(session, "")
assert str(e.value) == "Region cannot be empty"

@pytest.mark.skipif(
sys.version_info < (3, 6), reason="RequestsAWSV4SignerAuth requires python3.6+"
sys.version_info < (3, 6), reason="Urllib3AWSV4SignerAuth requires python3.6+"
)
def test_aws_signer_when_credentials_is_null(self):
region = "us-west-1"

from opensearchpy.helpers.signer import RequestsAWSV4SignerAuth
from opensearchpy.helpers.signer import Urllib3AWSV4SignerAuth

with pytest.raises(ValueError) as e:
RequestsAWSV4SignerAuth(None, region)
Urllib3AWSV4SignerAuth(None, region)
assert str(e.value) == "Credentials cannot be empty"

with pytest.raises(ValueError) as e:
RequestsAWSV4SignerAuth("", region)
Urllib3AWSV4SignerAuth("", region)
assert str(e.value) == "Credentials cannot be empty"

@pytest.mark.skipif(
Expand Down Expand Up @@ -508,7 +508,7 @@ def mock_session(self):
return dummy_session

@pytest.mark.skipif(
sys.version_info < (3, 6), reason="RequestsAWSV4SignerAuth requires python3.6+"
sys.version_info < (3, 6), reason="Urllib3AWSV4SignerAuth requires python3.6+"
)
def test_urllib3_http_connection_aws_signer_frozen_credentials_as_http_auth(self):
region = "us-west-2"
Expand Down

0 comments on commit ae1ebe1

Please sign in to comment.