-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow to set a signature port for tunnel usage
Signed-off-by: Andreas Lang <[email protected]>
- Loading branch information
1 parent
c8b04a5
commit 4e3ef98
Showing
4 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
# | ||
# Modifications Copyright OpenSearch Contributors. See | ||
# GitHub history for details. | ||
from unittest import TestCase | ||
|
||
from opensearchpy.helpers.signer import derive_signature_url | ||
|
||
|
||
class TestUrllib3Connection(TestCase): | ||
def test_derive_signature_url(self): | ||
assert ( | ||
derive_signature_url("http://localhost:10552/", singing_port=443) | ||
== "http://localhost:443/" | ||
) | ||
assert ( | ||
derive_signature_url("http://localhost:10552/foo/bar", singing_port=443) | ||
== "http://localhost:443/foo/bar" | ||
) | ||
assert ( | ||
derive_signature_url("http://localhost/", singing_port=443) | ||
== "http://localhost:443/" | ||
) | ||
assert ( | ||
derive_signature_url("http://localhost/foo/bar", singing_port=443) | ||
== "http://localhost:443/foo/bar" | ||
) | ||
|
||
def test_derive_signature_url_no_hostname(self): | ||
self.assertRaises(RuntimeError, derive_signature_url, "http://", 23) |