return expires_on from get-access-token #27410
Closed
Azure Pipelines / Azure.azure-cli Full Test
failed
Sep 17, 2023 in 20m 2s
Build #20230917.10 had test failures
Details
- Failed: 2 (0.02%)
- Passed: 10,392 (89.90%)
- Other: 1,165 (10.08%)
- Total: 11,559
Annotations
Check failure on line 1442 in Build log
azure-pipelines / Azure.azure-cli Full Test
Build log #L1442
Bash exited with code '1'.
Check failure on line 1445 in Build log
azure-pipelines / Azure.azure-cli Full Test
Build log #L1445
Bash exited with code '1'.
Check failure on line 1 in test_get_raw_token
azure-pipelines / Azure.azure-cli Full Test
test_get_raw_token
self = <azure.cli.command_modules.profile.tests.latest.test_profile_custom.ProfileCommandTest testMethod=test_get_raw_token>
get_raw_token_mock = <function get_raw_token at 0x7feb3c208310>
@mock.patch('azure.cli.core._profile.Profile.get_raw_token', autospec=True)
def test_get_raw_token(self, get_raw_token_mock):
cmd = mock.MagicMock()
cmd.cli_ctx = DummyCli()
get_raw_token_mock.return_value = (['bearer', 'token123', {'expiresOn': '2100-01-01'}], 'sub123', 'tenant123')
result = get_access_token(cmd)
# assert
get_raw_token_mock.assert_called_with(mock.ANY, None, None, None, None)
expected_result = {
'tokenType': 'bearer',
'accessToken': 'token123',
'expiresOn': '2100-01-01',
'subscription': 'sub123',
'tenant': 'tenant123'
}
> self.assertEqual(result, expected_result)
E AssertionError: {'tok[49 chars]pires_on': None, 'expiresOn': '2100-01-01', 't[41 chars]123'} != {'tok[49 chars]piresOn': '2100-01-01', 'subscription': 'sub12[21 chars]123'}
E {'accessToken': 'token123',
E 'expiresOn': '2100-01-01',
E - 'expires_on': None,
E 'subscription': 'sub123',
E 'tenant': 'tenant123',
E 'tokenType': 'bearer'}
src/azure-cli/azure/cli/command_modules/profile/tests/latest/test_profile_custom.py:53: AssertionError
Raw output
self = <azure.cli.command_modules.profile.tests.latest.test_profile_custom.ProfileCommandTest testMethod=test_get_raw_token>
get_raw_token_mock = <function get_raw_token at 0x7feb3c208310>
@mock.patch('azure.cli.core._profile.Profile.get_raw_token', autospec=True)
def test_get_raw_token(self, get_raw_token_mock):
cmd = mock.MagicMock()
cmd.cli_ctx = DummyCli()
get_raw_token_mock.return_value = (['bearer', 'token123', {'expiresOn': '2100-01-01'}], 'sub123', 'tenant123')
result = get_access_token(cmd)
# assert
get_raw_token_mock.assert_called_with(mock.ANY, None, None, None, None)
expected_result = {
'tokenType': 'bearer',
'accessToken': 'token123',
'expiresOn': '2100-01-01',
'subscription': 'sub123',
'tenant': 'tenant123'
}
> self.assertEqual(result, expected_result)
E AssertionError: {'tok[49 chars]pires_on': None, 'expiresOn': '2100-01-01', 't[41 chars]123'} != {'tok[49 chars]piresOn': '2100-01-01', 'subscription': 'sub12[21 chars]123'}
E {'accessToken': 'token123',
E 'expiresOn': '2100-01-01',
E - 'expires_on': None,
E 'subscription': 'sub123',
E 'tenant': 'tenant123',
E 'tokenType': 'bearer'}
src/azure-cli/azure/cli/command_modules/profile/tests/latest/test_profile_custom.py:53: AssertionError
Check failure on line 1 in test_get_raw_token
azure-pipelines / Azure.azure-cli Full Test
test_get_raw_token
self = <azure.cli.command_modules.profile.tests.latest.test_profile_custom.ProfileCommandTest testMethod=test_get_raw_token>
get_raw_token_mock = <function get_raw_token at 0x7f0029257b80>
@mock.patch('azure.cli.core._profile.Profile.get_raw_token', autospec=True)
def test_get_raw_token(self, get_raw_token_mock):
cmd = mock.MagicMock()
cmd.cli_ctx = DummyCli()
get_raw_token_mock.return_value = (['bearer', 'token123', {'expiresOn': '2100-01-01'}], 'sub123', 'tenant123')
result = get_access_token(cmd)
# assert
get_raw_token_mock.assert_called_with(mock.ANY, None, None, None, None)
expected_result = {
'tokenType': 'bearer',
'accessToken': 'token123',
'expiresOn': '2100-01-01',
'subscription': 'sub123',
'tenant': 'tenant123'
}
> self.assertEqual(result, expected_result)
E AssertionError: {'tok[49 chars]pires_on': None, 'expiresOn': '2100-01-01', 't[41 chars]123'} != {'tok[49 chars]piresOn': '2100-01-01', 'subscription': 'sub12[21 chars]123'}
E {'accessToken': 'token123',
E 'expiresOn': '2100-01-01',
E - 'expires_on': None,
E 'subscription': 'sub123',
E 'tenant': 'tenant123',
E 'tokenType': 'bearer'}
src/azure-cli/azure/cli/command_modules/profile/tests/latest/test_profile_custom.py:53: AssertionError
Raw output
self = <azure.cli.command_modules.profile.tests.latest.test_profile_custom.ProfileCommandTest testMethod=test_get_raw_token>
get_raw_token_mock = <function get_raw_token at 0x7f0029257b80>
@mock.patch('azure.cli.core._profile.Profile.get_raw_token', autospec=True)
def test_get_raw_token(self, get_raw_token_mock):
cmd = mock.MagicMock()
cmd.cli_ctx = DummyCli()
get_raw_token_mock.return_value = (['bearer', 'token123', {'expiresOn': '2100-01-01'}], 'sub123', 'tenant123')
result = get_access_token(cmd)
# assert
get_raw_token_mock.assert_called_with(mock.ANY, None, None, None, None)
expected_result = {
'tokenType': 'bearer',
'accessToken': 'token123',
'expiresOn': '2100-01-01',
'subscription': 'sub123',
'tenant': 'tenant123'
}
> self.assertEqual(result, expected_result)
E AssertionError: {'tok[49 chars]pires_on': None, 'expiresOn': '2100-01-01', 't[41 chars]123'} != {'tok[49 chars]piresOn': '2100-01-01', 'subscription': 'sub12[21 chars]123'}
E {'accessToken': 'token123',
E 'expiresOn': '2100-01-01',
E - 'expires_on': None,
E 'subscription': 'sub123',
E 'tenant': 'tenant123',
E 'tokenType': 'bearer'}
src/azure-cli/azure/cli/command_modules/profile/tests/latest/test_profile_custom.py:53: AssertionError
Loading