Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 10, 2023
1 parent 43f2070 commit e2b8073
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions tests/volumes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def test_binds(monkeypatch):
d.volumes = {"a": "b", "c": "d", "e": "f"}
assert d.volume_mount_points == ["b", "d", "f"]
d.volumes = {"/nfs/{username}": {"bind": "/home/{username}", "mode": "z"}}
assert d.volume_binds == {"/nfs/xyz": {"bind": "/home/xyz", "mode": "z", "propagation": 'rprivate'}}
assert d.volume_binds == {
"/nfs/xyz": {"bind": "/home/xyz", "mode": "z", "propagation": 'rprivate'}
}
assert d.volume_mount_points == ["/home/xyz"]


Expand All @@ -35,7 +37,13 @@ def test_format(label_template, spawner):
return "THIS IS A TEST"

d.format_volume_name = test_format
assert d.volume_binds == {"THIS IS A TEST": {"bind": "THIS IS A TEST", "mode": "z", "propagation": 'rprivate'}}
assert d.volume_binds == {
"THIS IS A TEST": {
"bind": "THIS IS A TEST",
"mode": "z",
"propagation": 'rprivate',
}
}
assert d.volume_mount_points == ["THIS IS A TEST"]


Expand All @@ -46,7 +54,11 @@ def test_default_format_volume_name(monkeypatch):
d.user = types.SimpleNamespace(name="[email protected]")
d.volumes = {"data/{username}": {"bind": "/home/{raw_username}", "mode": "z"}}
assert d.volume_binds == {
"data/user-40email-2ecom": {"bind": "/home/[email protected]", "mode": "z", "propagation": 'rprivate'}
"data/user-40email-2ecom": {
"bind": "/home/[email protected]",
"mode": "z",
"propagation": 'rprivate',
}
}
assert d.volume_mount_points == ["/home/[email protected]"]

Expand All @@ -60,7 +72,11 @@ def test_escaped_format_volume_name(monkeypatch):
d.volumes = {"data/{username}": {"bind": "/home/{username}", "mode": "z"}}
d.format_volume_name = dockerspawner.volumenamingstrategy.escaped_format_volume_name
assert d.volume_binds == {
"data/user-40email-2ecom": {"bind": "/home/user-40email-2ecom", "mode": "z", "propagation": 'rprivate'}
"data/user-40email-2ecom": {
"bind": "/home/user-40email-2ecom",
"mode": "z",
"propagation": 'rprivate',
}
}
assert d.volume_mount_points == ["/home/user-40email-2ecom"]

Expand Down

0 comments on commit e2b8073

Please sign in to comment.