STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_config_upload_confined Namespace Reference

Functions

 root (tmp_path, monkeypatch)
 client ()
set[Path] _yaml_files (Path base)
 test_a_climbing_filename_lands_in_the_users_folder (root, tmp_path, client)
 test_an_absolute_filename_does_not_replace_the_folder (root, tmp_path, client)
 test_a_file_that_does_not_parse_is_not_written (root, tmp_path, client)
 test_a_file_that_is_not_a_config_is_not_written (root, tmp_path, client)
 test_names_that_are_not_yaml_files_are_refused (root, client, name)

Variables

 reason
dict H = {"X-Auth-Email": "upload-confined@berkeley.edu"}
 VALID = session_mod._DEFAULT_CONFIG_PATH.read_bytes()

Detailed Description

POST /api/config/upload writes only a basename, only under the caller's folder, only if it parses.

The multipart filename is the client's string. Joined onto the uploads folder as given,
"../../../x.yaml" climbed out of output/user_configs/<user>/ and an absolute path replaced the
folder outright (pathlib's ``/`` drops the left side for an absolute right side) -- so a request
naming /app/configs/default.yaml overwrote the default every new session loads. The bytes were
written before they were parsed, so even a file answered with 400 "Invalid YAML" had landed.

Function Documentation

◆ _yaml_files()

set[Path] test_config_upload_confined._yaml_files ( Path base)
protected

◆ client()

test_config_upload_confined.client ( )

Definition at line 43 of file test_config_upload_confined.py.

◆ root()

test_config_upload_confined.root ( tmp_path,
monkeypatch )
A project root three folders deep, so a climb of three lands inside tmp_path.

Definition at line 33 of file test_config_upload_confined.py.

◆ test_a_climbing_filename_lands_in_the_users_folder()

test_config_upload_confined.test_a_climbing_filename_lands_in_the_users_folder ( root,
tmp_path,
client )

Definition at line 51 of file test_config_upload_confined.py.

References _yaml_files().

◆ test_a_file_that_does_not_parse_is_not_written()

test_config_upload_confined.test_a_file_that_does_not_parse_is_not_written ( root,
tmp_path,
client )

Definition at line 79 of file test_config_upload_confined.py.

References _yaml_files().

◆ test_a_file_that_is_not_a_config_is_not_written()

test_config_upload_confined.test_a_file_that_is_not_a_config_is_not_written ( root,
tmp_path,
client )

Definition at line 89 of file test_config_upload_confined.py.

References _yaml_files().

◆ test_an_absolute_filename_does_not_replace_the_folder()

test_config_upload_confined.test_an_absolute_filename_does_not_replace_the_folder ( root,
tmp_path,
client )

Definition at line 67 of file test_config_upload_confined.py.

◆ test_names_that_are_not_yaml_files_are_refused()

test_config_upload_confined.test_names_that_are_not_yaml_files_are_refused ( root,
client,
name )

Definition at line 100 of file test_config_upload_confined.py.

Variable Documentation

◆ H

dict test_config_upload_confined.H = {"X-Auth-Email": "upload-confined@berkeley.edu"}

Definition at line 28 of file test_config_upload_confined.py.

◆ reason

test_config_upload_confined.reason

Definition at line 20 of file test_config_upload_confined.py.

◆ VALID

test_config_upload_confined.VALID = session_mod._DEFAULT_CONFIG_PATH.read_bytes()

Definition at line 29 of file test_config_upload_confined.py.