Skip to content

Commit 82ea9fa

Browse files
committed
Fixed formatting and updated .gitignore to include test created files
1 parent 6a8ba7c commit 82ea9fa

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ Pipfile.lock
77
poetry.lock
88
.venv*
99
build/
10+
tls-cluster-namespace
11+
quicktest.yaml

tests/unit_test.py

+22-23
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from codeflare_sdk.cluster.auth import (
3737
TokenAuthentication,
3838
Authentication,
39-
KubeConfigFileAuthentication
39+
KubeConfigFileAuthentication,
4040
)
4141
from codeflare_sdk.utils.pretty_print import (
4242
print_no_resources_found,
@@ -115,7 +115,9 @@ def test_token_auth_creation():
115115
assert token_auth.server == "server"
116116
assert token_auth.skip_tls == False
117117

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+
)
119121
assert token_auth.token == "token"
120122
assert token_auth.server == "server"
121123
assert token_auth.skip_tls == False
@@ -126,46 +128,43 @@ def test_token_auth_creation():
126128

127129

128130
def test_token_auth_login_logout(mocker):
129-
mocker.patch.object(client, 'ApiClient')
131+
mocker.patch.object(client, "ApiClient")
130132

131133
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")
138136

139137

140138
def test_token_auth_login_tls(mocker):
141-
mocker.patch.object(client, 'ApiClient')
139+
mocker.patch.object(client, "ApiClient")
142140

143141
token_auth = TokenAuthentication(
144142
token="testtoken", server="testserver:6443", skip_tls=True
145143
)
146-
assert token_auth.login() == (
147-
"Logged into testserver:6443"
148-
)
144+
assert token_auth.login() == ("Logged into testserver:6443")
149145
token_auth = TokenAuthentication(
150146
token="testtoken", server="testserver:6443", skip_tls=False
151147
)
152-
assert token_auth.login() == (
153-
"Logged into testserver:6443"
154-
)
148+
assert token_auth.login() == ("Logged into testserver:6443")
155149
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",
160154
)
155+
assert token_auth.login() == ("Logged into testserver:6443")
156+
161157

162158
def test_load_kube_config(mocker):
163159
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")
166162

167163
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+
)
169168

170169

171170
def test_auth_coverage():

0 commit comments

Comments
 (0)