|
9 | 9 |
|
10 | 10 | sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))) |
11 | 11 | from azext_connectedk8s._utils import ( |
| 12 | + get_mcr_path, |
12 | 13 | process_helm_error_detail, |
13 | 14 | redact_sensitive_fields_from_string, |
14 | 15 | remove_rsa_private_key, |
@@ -76,5 +77,27 @@ def test_redact_sensitive_fields_from_string(): |
76 | 77 | ) |
77 | 78 |
|
78 | 79 |
|
| 80 | +def test_get_mcr_path(): |
| 81 | + input_active_directory = "login.microsoftonline.com" |
| 82 | + expected_output = "mcr.microsoft.com" |
| 83 | + assert get_mcr_path(input_active_directory) == expected_output |
| 84 | + |
| 85 | + input_active_directory = "login.microsoftonline.us" |
| 86 | + expected_output = "mcr.microsoft.com" |
| 87 | + assert get_mcr_path(input_active_directory) == expected_output |
| 88 | + |
| 89 | + input_active_directory = "login.chinacloudapi.cn" |
| 90 | + expected_output = "mcr.microsoft.com" |
| 91 | + assert get_mcr_path(input_active_directory) == expected_output |
| 92 | + |
| 93 | + input_active_directory = "https://login.microsoftonline.microsoft.foo" |
| 94 | + expected_output = "mcr.microsoft.foo" |
| 95 | + assert get_mcr_path(input_active_directory) == expected_output |
| 96 | + |
| 97 | + input_active_directory = "https://login.microsoftonline.some.cloud.bar" |
| 98 | + expected_output = "mcr.microsoft.some.cloud.bar" |
| 99 | + assert get_mcr_path(input_active_directory) == expected_output |
| 100 | + |
| 101 | + |
79 | 102 | if __name__ == "__main__": |
80 | 103 | pytest.main() |
0 commit comments