10
10
CREDENTIALS = {
11
11
"AccessKeyId" : "access_key_id" ,
12
12
"SecretAccessKey" : "secret_access_key" ,
13
- "SessionToken" : "session_token"
13
+ "SessionToken" : "session_token" ,
14
+ "Expiration" : "expiration"
14
15
}
15
16
16
17
@@ -35,6 +36,7 @@ def test_run(self, mock_print):
35
36
'{"AccessKeyId": "access_key_id", '
36
37
'"SecretAccessKey": "secret_access_key", '
37
38
'"SessionToken": "session_token", '
39
+ '"Expiration": "expiration", '
38
40
'"Version": 1}'
39
41
)
40
42
@@ -50,7 +52,8 @@ def test_run_nt(self, mock_print, mock_os):
50
52
mock_print .assert_called_once_with (
51
53
"$env:AWS_ACCESS_KEY_ID='access_key_id'; "
52
54
"$env:AWS_SECRET_ACCESS_KEY='secret_access_key'; "
53
- "$env:AWS_SESSION_TOKEN='session_token'"
55
+ "$env:AWS_SESSION_TOKEN='session_token'; "
56
+ "$env:AWS_CREDENTIAL_EXPIRATION='expiration'"
54
57
)
55
58
56
59
@patch ("aws_okta_processor.commands.authenticate.os" )
@@ -65,7 +68,8 @@ def test_run_linux(self, mock_print, mock_os):
65
68
mock_print .assert_called_once_with (
66
69
"export AWS_ACCESS_KEY_ID='access_key_id' && "
67
70
"export AWS_SECRET_ACCESS_KEY='secret_access_key' && "
68
- "export AWS_SESSION_TOKEN='session_token'"
71
+ "export AWS_SESSION_TOKEN='session_token' && "
72
+ "export AWS_CREDENTIAL_EXPIRATION='expiration'"
69
73
)
70
74
71
75
def test_get_configuration_env (self ):
@@ -81,9 +85,10 @@ def test_output_export_command_with_fish_as_target_shell(self):
81
85
self .OPTIONS ["--target-shell" ] = "fish"
82
86
auth = Authenticate (self .OPTIONS )
83
87
credentials = {
84
- "AccessKeyId" : "XXXXX" ,
85
- "SecretAccessKey" : "YYYYY" ,
86
- "SessionToken" : "ZZZZZ"
88
+ "AccessKeyId" : "WWWWW" ,
89
+ "SecretAccessKey" : "XXXXX" ,
90
+ "SessionToken" : "YYYYY" ,
91
+ "Expiration" : "ZZZZZ"
87
92
}
88
93
self .assertNotIsInstance (
89
94
auth .unix_output (credentials ).index ("set --export" ),
@@ -95,9 +100,10 @@ def test_output_export_command_with_default_target_shell(self):
95
100
96
101
auth = Authenticate (self .OPTIONS )
97
102
credentials = {
98
- "AccessKeyId" : "XXXXX" ,
99
- "SecretAccessKey" : "YYYYY" ,
100
- "SessionToken" : "ZZZZZ"
103
+ "AccessKeyId" : "WWWWW" ,
104
+ "SecretAccessKey" : "XXXXX" ,
105
+ "SessionToken" : "YYYYY" ,
106
+ "Expiration" : "ZZZZZ"
101
107
}
102
108
self .assertNotIsInstance (
103
109
auth .unix_output (credentials ).index ("export " ),
@@ -113,9 +119,10 @@ def test_output_export_command_for_windows(self):
113
119
114
120
auth = Authenticate (self .OPTIONS )
115
121
credentials = {
116
- "AccessKeyId" : "XXXXX" ,
117
- "SecretAccessKey" : "YYYYY" ,
118
- "SessionToken" : "ZZZZZ"
122
+ "AccessKeyId" : "WWWWW" ,
123
+ "SecretAccessKey" : "XXXXX" ,
124
+ "SessionToken" : "YYYYY" ,
125
+ "Expiration" : "ZZZZZ"
119
126
}
120
127
self .assertNotIsInstance (
121
128
auth .nt_output (credentials ).index ("$env:" ),
0 commit comments