15
15
def test_cli_args (container : TrackedContainer , http_client : requests .Session ) -> None :
16
16
"""Image should respect command line args (e.g., disabling token security)"""
17
17
host_port = find_free_port ()
18
- running_container = container .run_detached (
18
+ container .run_detached (
19
19
command = ["start-notebook.py" , "--IdentityProvider.token=''" ],
20
20
ports = {"8888/tcp" : host_port },
21
21
)
22
22
resp = http_client .get (f"http://localhost:{ host_port } " )
23
23
resp .raise_for_status ()
24
- logs = running_container . logs (). decode ()
24
+ logs = container . get_logs ()
25
25
LOGGER .debug (logs )
26
26
assert "ERROR" not in logs
27
27
warnings = TrackedContainer .get_warnings (logs )
@@ -32,7 +32,7 @@ def test_cli_args(container: TrackedContainer, http_client: requests.Session) ->
32
32
def test_nb_user_change (container : TrackedContainer ) -> None :
33
33
"""Container should change the username (`NB_USER`) of the default user."""
34
34
nb_user = "nayvoj"
35
- running_container = container .run_detached (
35
+ container .run_detached (
36
36
tty = True ,
37
37
user = "root" ,
38
38
environment = [f"NB_USER={ nb_user } " , "CHOWN_HOME=yes" ],
@@ -47,8 +47,7 @@ def test_nb_user_change(container: TrackedContainer) -> None:
47
47
)
48
48
command = f'stat -c "%F %U %G" /home/{ nb_user } /.jupyter'
49
49
expected_output = f"directory { nb_user } users"
50
- exec_result = running_container .exec_run (command , workdir = f"/home/{ nb_user } " )
51
- output = exec_result .output .decode ().strip ("\n " )
50
+ output = container .exec_cmd (command , workdir = f"/home/{ nb_user } " )
52
51
assert (
53
52
output == expected_output
54
53
), f"Hidden folder .jupyter was not copied properly to { nb_user } home folder. stat: { output } , expected { expected_output } "
@@ -62,7 +61,7 @@ def test_unsigned_ssl(
62
61
and Jupyter Server should use it to enable HTTPS.
63
62
"""
64
63
host_port = find_free_port ()
65
- running_container = container .run_detached (
64
+ container .run_detached (
66
65
environment = ["GEN_CERT=yes" ],
67
66
ports = {"8888/tcp" : host_port },
68
67
)
@@ -74,7 +73,7 @@ def test_unsigned_ssl(
74
73
resp = http_client .get (f"https://localhost:{ host_port } " , verify = False )
75
74
resp .raise_for_status ()
76
75
assert "login_submit" in resp .text
77
- logs = running_container . logs (). decode ()
76
+ logs = container . get_logs ()
78
77
assert "ERROR" not in logs
79
78
warnings = TrackedContainer .get_warnings (logs )
80
79
assert not warnings
@@ -102,14 +101,14 @@ def test_custom_internal_port(
102
101
when using custom internal port"""
103
102
host_port = find_free_port ()
104
103
internal_port = env .get ("JUPYTER_PORT" , 8888 )
105
- running_container = container .run_detached (
104
+ container .run_detached (
106
105
command = ["start-notebook.py" , "--IdentityProvider.token=''" ],
107
106
environment = env ,
108
107
ports = {internal_port : host_port },
109
108
)
110
109
resp = http_client .get (f"http://localhost:{ host_port } " )
111
110
resp .raise_for_status ()
112
- logs = running_container . logs (). decode ()
111
+ logs = container . get_logs ()
113
112
LOGGER .debug (logs )
114
113
assert "ERROR" not in logs
115
114
warnings = TrackedContainer .get_warnings (logs )
0 commit comments