stages,test: fix lint errors and add basic unit tests
Add very simple unit tests as a starting point for the new parsing functions in `util/parsing.py`.
This commit is contained in:
parent
6d4d1962eb
commit
249107a028
6 changed files with 47 additions and 12 deletions
|
|
@ -37,3 +37,41 @@ def test_parse_size():
|
|||
else:
|
||||
res = parsing.parse_size(s)
|
||||
assert res == num, f"{s} parsed as {res} (wanted {num})"
|
||||
|
||||
|
||||
def test_parse_location_mounts():
|
||||
args = {
|
||||
"paths": {
|
||||
"mounts": "/run/osbuild/mounts",
|
||||
},
|
||||
"mounts": {
|
||||
"root": {
|
||||
"path": "/run/osbuild/mounts/.",
|
||||
},
|
||||
},
|
||||
}
|
||||
location = "mount://root/"
|
||||
path = parsing.parse_location(location, args)
|
||||
assert path == "/run/osbuild/mounts/."
|
||||
|
||||
|
||||
def test_parse_location_tree():
|
||||
args = {
|
||||
"tree": "/run/osbuild/tree",
|
||||
}
|
||||
location = "tree:///disk.img"
|
||||
path = parsing.parse_location(location, args)
|
||||
assert path == "/run/osbuild/tree/disk.img"
|
||||
|
||||
|
||||
def test_parse_location_inputs():
|
||||
args = {
|
||||
"inputs": {
|
||||
"tree": {
|
||||
"path": "/run/osbuild/inputs/tree",
|
||||
},
|
||||
},
|
||||
}
|
||||
location = "input://tree/"
|
||||
path = parsing.parse_location(location, args)
|
||||
assert path == "/run/osbuild/inputs/tree/."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue