20
20
21
21
from .config_exception import ConfigException
22
22
from .exec_provider import ExecProvider
23
+ from .kube_config import ConfigNode
23
24
24
25
25
26
class ExecProviderTest (TestCase ):
26
27
27
28
def setUp (self ):
28
- self .input_ok = {
29
+ self .input_ok = ConfigNode ( 'test' , {
29
30
'command' : 'aws-iam-authenticator token -i dummy' ,
30
- 'apiVersion' : 'client.authentication.k8s.io/v1beta1'
31
- }
31
+ 'apiVersion' : 'client.authentication.k8s.io/v1beta1' ,
32
+ 'env' : None
33
+ })
32
34
self .output_ok = """
33
35
{
34
36
"apiVersion": "client.authentication.k8s.io/v1beta1",
@@ -127,8 +129,12 @@ async def test_ok_01(self):
127
129
self .process_mock .wait .assert_awaited_once ()
128
130
129
131
async def test_ok_with_args (self ):
130
- self .input_ok ['args' ] = ['--mock' , '90' ]
131
- ep = ExecProvider (self .input_ok )
132
+ input_ok = ConfigNode ('test' , {
133
+ 'command' : 'aws-iam-authenticator token -i dummy' ,
134
+ 'apiVersion' : 'client.authentication.k8s.io/v1beta1' ,
135
+ 'args' : ['--mock' , '90' ]
136
+ })
137
+ ep = ExecProvider (input_ok )
132
138
result = await ep .run ()
133
139
self .assertTrue (isinstance (result , dict ))
134
140
self .assertTrue ('token' in result )
@@ -140,10 +146,13 @@ async def test_ok_with_args(self):
140
146
141
147
async def test_ok_with_env (self ):
142
148
143
- self .input_ok ['env' ] = [{'name' : 'EXEC_PROVIDER_ENV_NAME' ,
144
- 'value' : 'EXEC_PROVIDER_ENV_VALUE' }]
149
+ input_ok = ConfigNode ('test' , {
150
+ 'command' : 'aws-iam-authenticator token -i dummy' ,
151
+ 'apiVersion' : 'client.authentication.k8s.io/v1beta1' ,
152
+ 'env' : [{'name' : 'EXEC_PROVIDER_ENV_NAME' ,
153
+ 'value' : 'EXEC_PROVIDER_ENV_VALUE' }]})
145
154
146
- ep = ExecProvider (self . input_ok )
155
+ ep = ExecProvider (input_ok )
147
156
result = await ep .run ()
148
157
self .assertTrue (isinstance (result , dict ))
149
158
self .assertTrue ('token' in result )
0 commit comments