Skip to content

Commit 2c20748

Browse files
committed
chore: upgrade some dependencies
1 parent 7833db7 commit 2c20748

File tree

6 files changed

+32
-32
lines changed

6 files changed

+32
-32
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ You can check out this [post](http://ouba.online/blog/2023/3/8/you_probably_dont
1212

1313
`notebook-on-kube` provides the following features:
1414

15-
It provides the following features:
1615
- Authn/authz based on `Kubernetes'`.
1716
- Customize and create notebooks.
1817
- Connect to notebooks.

deploy/notebook-on-kube/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: notebook-on-kube
33
description: A Helm chart to deploy notebook-on-kube
44
type: application
5-
version: 0.2.1
5+
version: 0.2.2
66
home: https://github.com/machine424/notebook-on-kube
77
dependencies:
88
- name: ingress-nginx

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "notebook-on-kube"
7-
version = "0.2.1"
7+
version = "0.2.2"
88
description = "A tool to deploy Notebooks on Kubernetes."
99
readme = "README.md"
1010
authors = [
@@ -25,7 +25,7 @@ dependencies = [
2525
notebook-on-kube = "notebook_on_kube.main:run"
2626

2727
[project.optional-dependencies]
28-
test = ["black", "isort", "flake8", "mypy", "pytest", "pytest-mock", "requests"]
28+
test = ["black", "isort", "flake8", "mypy", "pytest", "pytest-mock", "httpx"]
2929

3030
[project.urls]
3131
"Homepage" = "https://github.com/machine424/notebook-on-kube"

requirements.txt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,31 @@ anyio==3.6.2
88
# via starlette
99
click==8.1.3
1010
# via uvicorn
11-
fastapi==0.85.1
11+
fastapi==0.93.0
1212
# via notebook-on-kube (pyproject.toml)
1313
h11==0.14.0
1414
# via uvicorn
1515
idna==3.4
1616
# via anyio
1717
jinja2==3.1.2
1818
# via notebook-on-kube (pyproject.toml)
19-
markupsafe==2.1.1
19+
markupsafe==2.1.2
2020
# via jinja2
21-
pydantic==1.10.2
21+
pydantic==1.10.5
2222
# via fastapi
2323
pyjwt==2.6.0
2424
# via notebook-on-kube (pyproject.toml)
25-
python-multipart==0.0.5
25+
python-multipart==0.0.6
2626
# via notebook-on-kube (pyproject.toml)
2727
ruamel-yaml==0.17.21
2828
# via notebook-on-kube (pyproject.toml)
2929
ruamel-yaml-clib==0.2.7
3030
# via ruamel-yaml
31-
six==1.16.0
32-
# via python-multipart
3331
sniffio==1.3.0
3432
# via anyio
35-
starlette==0.20.4
33+
starlette==0.25.0
3634
# via fastapi
37-
typing-extensions==4.4.0
35+
typing-extensions==4.5.0
3836
# via pydantic
39-
uvicorn==0.19.0
37+
uvicorn==0.20.0
4038
# via notebook-on-kube (pyproject.toml)

src/notebook_on_kube/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ def form_data_to_values_file(cls, *, form_data: FormData) -> IO | None:
278278

279279
class NotebookStatus:
280280
class Notebook(BaseModel, extra=Extra.forbid):
281-
282281
missing_statefulset: ClassVar[str] = "StatefulSet Missing"
283282
not_running: ClassVar[str] = "Not Running"
284283
error: ClassVar[str] = "Error"

tests/test_api.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
)
2929
FAKE_NOTEBOOK = "my-notebook"
3030

31-
client = TestClient(app)
31+
32+
@pytest.fixture()
33+
def test_client():
34+
return TestClient(app)
3235

3336

3437
@pytest.fixture()
@@ -131,30 +134,31 @@ def test_complete_notebook_name_from_form(mocker, notebook_name, username, compl
131134
assert complete_notebook_name_from_form(notebook_name=notebook_name, username=username) == complete_notebook_name
132135

133136

134-
def test_healthz():
135-
response = client.get("api/healthz")
137+
def test_healthz(test_client):
138+
response = test_client.get("api/healthz")
136139
assert response.status_code == 200
137140
assert response.json()["status"] == "Seems healthy"
138141

139142

140-
def test_root():
141-
response = client.get("/")
143+
def test_root(test_client):
144+
response = test_client.get("/")
142145
assert response.status_code == 200
143146
assert response.template.name == "index.html"
144147
assert response.context["kube_cluster_name"] is None
145148

146149

147-
def test_login(validate_kube_token_mock):
148-
response = client.post("api/login/", data={"kube_token": FAKE_OIDC_TOKEN}, allow_redirects=False)
150+
def test_login(validate_kube_token_mock, test_client):
151+
response = test_client.post("api/login/", data={"kube_token": FAKE_OIDC_TOKEN}, follow_redirects=False)
149152
assert response.status_code == 303
150153
assert response.headers["location"] == "/api/notebooks/"
151154
# We do not send the cookie when connecting to Notebooks (non /api)
152-
assert response.cookies.get_dict(path="/api")["kube_token"] == FAKE_OIDC_TOKEN
155+
assert response.cookies.get(name="kube_token", path="/api") == FAKE_OIDC_TOKEN
153156

154157

155158
def test_notebooks(mocker, validate_kube_token_mock):
156159
helm = mocker.patch("notebook_on_kube.main.helm", return_value="{}")
157-
response = client.get("api/notebooks/", cookies={"kube_token": FAKE_OIDC_TOKEN})
160+
client = TestClient(app=app, cookies={"kube_token": FAKE_OIDC_TOKEN})
161+
response = client.get("api/notebooks/")
158162
helm.assert_called_once_with(
159163
body=["list", "--filter", f"^nok-{FAKE_USERNAME}-.+$", "--all", "--output", "json"], kube_token=FAKE_OIDC_TOKEN
160164
)
@@ -177,9 +181,8 @@ def test_delete_notebook(mocker, validate_kube_token_mock, existing, helm_list_o
177181
helm_list_call = mocker.call(
178182
body=["list", "--filter", f"^{FAKE_NOTEBOOK}$", "--all", "--output", "json"], kube_token=FAKE_OIDC_TOKEN
179183
)
180-
response = client.post(
181-
f"api/delete_notebook/{FAKE_NOTEBOOK}", cookies={"kube_token": FAKE_OIDC_TOKEN}, allow_redirects=False
182-
)
184+
client = TestClient(app=app, cookies={"kube_token": FAKE_OIDC_TOKEN})
185+
response = client.post(f"api/delete_notebook/{FAKE_NOTEBOOK}", follow_redirects=False)
183186
assert response.status_code == status_code
184187
if existing:
185188
assert response.headers["location"] == "/api/notebooks/"
@@ -195,7 +198,8 @@ def test_delete_notebook(mocker, validate_kube_token_mock, existing, helm_list_o
195198
def test_notebook_events(mocker, validate_kube_token_mock, event):
196199
mocker.patch("notebook_on_kube.main.notebook_exists", return_value=True)
197200
kubectl = mocker.patch("notebook_on_kube.main.kubectl", return_value=event)
198-
response = client.get(f"api/notebook_events/{FAKE_NOTEBOOK}", cookies={"kube_token": FAKE_OIDC_TOKEN})
201+
client = TestClient(app=app, cookies={"kube_token": FAKE_OIDC_TOKEN})
202+
response = client.get(f"api/notebook_events/{FAKE_NOTEBOOK}")
199203
assert response.status_code == 200
200204
assert (
201205
response.text
@@ -224,10 +228,10 @@ def test_notebook_events(mocker, validate_kube_token_mock, event):
224228
def test_scale_notebook(mocker, validate_kube_token_mock, scale):
225229
mocker.patch("notebook_on_kube.main.notebook_exists", return_value=True)
226230
kubectl = mocker.patch("notebook_on_kube.main.kubectl")
231+
client = TestClient(app=app, cookies={"kube_token": FAKE_OIDC_TOKEN})
227232
response = client.get(
228233
f"api/scale_notebook/{FAKE_NOTEBOOK}?scale={scale}",
229-
cookies={"kube_token": FAKE_OIDC_TOKEN},
230-
allow_redirects=False,
234+
follow_redirects=False,
231235
)
232236
assert response.status_code == 303
233237
assert response.headers["location"] == "/api/notebooks/"
@@ -245,9 +249,9 @@ def test_scale_notebook(mocker, validate_kube_token_mock, scale):
245249

246250

247251
def test_new_notebook(validate_kube_token_mock):
252+
client = TestClient(app=app, cookies={"kube_token": FAKE_OIDC_TOKEN})
248253
response = client.get(
249254
"api/new_notebook/",
250-
cookies={"kube_token": FAKE_OIDC_TOKEN},
251255
)
252256
assert response.status_code == 200
253257
assert response.template.name == "new_notebook.html"
@@ -270,11 +274,11 @@ def test_create_notebook(mocker, validate_kube_token_mock, existing, helm_values
270274
yaml_load = mocker.spy(yaml, "load")
271275
yaml_dump = mocker.spy(yaml, "dump")
272276

277+
client = TestClient(app=app, cookies={"kube_token": FAKE_OIDC_TOKEN})
273278
response = client.post(
274279
"api/create_notebook/",
275-
cookies={"kube_token": FAKE_OIDC_TOKEN},
276280
data={"notebook_name": FAKE_NOTEBOOK, "helm_values": helm_values},
277-
allow_redirects=False,
281+
follow_redirects=False,
278282
)
279283
assert response.status_code == status_code
280284
if not existing:

0 commit comments

Comments
 (0)