-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: sss_ssh_knownhosts with port number
Add tests cases with port numbers Signed-off-by: Madhuri Upadhye <[email protected]>
- Loading branch information
1 parent
823d787
commit a1a5260
Showing
3 changed files
with
120 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
4444 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCI56aGtsWIbjz8XhODRT8NAio+TIHMXdiKoG6SdCtVlCR6xNP6gXgmChVWJ9DXlOF3WztOBf9om5SsPGX73/to= | ||
4444 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPeSgRv4Vyq6ehrcA8hc6LFd9cUR1H3vdtH+WMJXvf1h | ||
4444 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC4O+2dXWi4iTJR3vlsqZE9707K0sKTeEnWHyMoWUY0N/p6TZgxoLWfUW8XPbj4Yt4BaI6M48/jWZjHjXPJjLfgon3BT5LvyZHrlnN34APcZ7+r73mMt4pIPI7WnzqJluRGgcdEQuJhaSUbTGBUoHwCmp5JAREqWMappkwwSo9QQEzeAxT58dLTEyENTxB1DCP7sJShZd9p+37+5XJ1m1fkpnpDb/JMnTX9jSApk6r2DOZgcpX2aNFMbxSQ5zASfhmzJCfx52c97GD85Zx+LMXBJ4KzNKAbvTsruFj3k5jh7pYvqZseUuReBDCjSGQ4Q4MDBm+XAPbCNfQcgLPo678kkIFK8bZfKLDeJH4g64EO1xHGxBhmcYiXkc0gyqpECKekiUb3ltkyUA/R+Q8Jo+Zr70IHEM2fFvyiIqyz2Nx3PH/FTLDSBguQuEtzBHcMfb9/sO8lbofJneAfsAk3C3TYxqJ176xYqk4C24pB8UrOAflni+P0RqS1Zwte2u3ZD0E= |
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,27 @@ | ||
import pytest | ||
|
||
# Function to test | ||
def format_output(option, hostname, port, key): | ||
if option == "-o": | ||
return f"{hostname} {key}" | ||
else: | ||
return f"{hostname}:{port} {key}" | ||
|
||
# Parameterized test | ||
@pytest.mark.parametrize("option, expected_output", [ | ||
(None, "{hostname}:{port} {key}"), | ||
("-o", "{hostname} {key}") | ||
]) | ||
def test_format_output(option, expected_output): | ||
# Example inputs | ||
hostname = "localhost" | ||
port = 8080 | ||
key = "my_key" | ||
|
||
# Get the actual output from the function | ||
actual_output = format_output(option, hostname, port, key) | ||
|
||
# Replace placeholders with actual values for comparison | ||
expected_output_formatted = expected_output.format(hostname=hostname, port=port, key=key) | ||
|
||
assert actual_output == expected_output_formatted |
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