36
36
from codeflare_sdk .cluster .auth import (
37
37
TokenAuthentication ,
38
38
Authentication ,
39
- KubeConfigFileAuthentication
39
+ KubeConfigFileAuthentication ,
40
40
)
41
41
from codeflare_sdk .utils .pretty_print import (
42
42
print_no_resources_found ,
@@ -115,7 +115,9 @@ def test_token_auth_creation():
115
115
assert token_auth .server == "server"
116
116
assert token_auth .skip_tls == False
117
117
118
- token_auth = TokenAuthentication (token = "token" , server = "server" , skip_tls = False , ca_cert_path = "path/to/cert" )
118
+ token_auth = TokenAuthentication (
119
+ token = "token" , server = "server" , skip_tls = False , ca_cert_path = "path/to/cert"
120
+ )
119
121
assert token_auth .token == "token"
120
122
assert token_auth .server == "server"
121
123
assert token_auth .skip_tls == False
@@ -126,46 +128,43 @@ def test_token_auth_creation():
126
128
127
129
128
130
def test_token_auth_login_logout (mocker ):
129
- mocker .patch .object (client , ' ApiClient' )
131
+ mocker .patch .object (client , " ApiClient" )
130
132
131
133
token_auth = TokenAuthentication (token = "testtoken" , server = "testserver:6443" )
132
- assert token_auth .login () == (
133
- "Logged into testserver:6443"
134
- )
135
- assert token_auth .logout () == (
136
- "Successfully logged out of testserver:6443"
137
- )
134
+ assert token_auth .login () == ("Logged into testserver:6443" )
135
+ assert token_auth .logout () == ("Successfully logged out of testserver:6443" )
138
136
139
137
140
138
def test_token_auth_login_tls (mocker ):
141
- mocker .patch .object (client , ' ApiClient' )
139
+ mocker .patch .object (client , " ApiClient" )
142
140
143
141
token_auth = TokenAuthentication (
144
142
token = "testtoken" , server = "testserver:6443" , skip_tls = True
145
143
)
146
- assert token_auth .login () == (
147
- "Logged into testserver:6443"
148
- )
144
+ assert token_auth .login () == ("Logged into testserver:6443" )
149
145
token_auth = TokenAuthentication (
150
146
token = "testtoken" , server = "testserver:6443" , skip_tls = False
151
147
)
152
- assert token_auth .login () == (
153
- "Logged into testserver:6443"
154
- )
148
+ assert token_auth .login () == ("Logged into testserver:6443" )
155
149
token_auth = TokenAuthentication (
156
- token = "testtoken" , server = "testserver:6443" , skip_tls = False , ca_cert_path = "path/to/cert"
157
- )
158
- assert token_auth . login () == (
159
- "Logged into testserver:6443"
150
+ token = "testtoken" ,
151
+ server = "testserver:6443" ,
152
+ skip_tls = False ,
153
+ ca_cert_path = "path/to/cert" ,
160
154
)
155
+ assert token_auth .login () == ("Logged into testserver:6443" )
156
+
161
157
162
158
def test_load_kube_config (mocker ):
163
159
kube_config_auth = KubeConfigFileAuthentication ()
164
- kube_config_auth .kube_config_path = ' /path/to/your/config'
165
- mocker .patch .object (config , ' load_kube_config' )
160
+ kube_config_auth .kube_config_path = " /path/to/your/config"
161
+ mocker .patch .object (config , " load_kube_config" )
166
162
167
163
response = kube_config_auth .load_kube_config ()
168
- assert response == "Loaded user config file at path %s" % kube_config_auth .kube_config_path
164
+ assert (
165
+ response
166
+ == "Loaded user config file at path %s" % kube_config_auth .kube_config_path
167
+ )
169
168
170
169
171
170
def test_auth_coverage ():
0 commit comments