diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-09-06 17:50:24 +0100 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-09-14 10:51:48 +0100 |
commit | f0cf37a3fb3a7c9c5a405c63df09363a33f49577 (patch) | |
tree | 27e454431c856a9398d2fccf7f5fad52f0136b6c /tests/loader | |
parent | 06b4d3aeae88a30d922cd044feaf9f255946fe55 (diff) | |
download | buildstream-f0cf37a3fb3a7c9c5a405c63df09363a33f49577.tar.gz |
Add element node validations
Diffstat (limited to 'tests/loader')
-rw-r--r-- | tests/loader/basics.py | 12 | ||||
-rw-r--r-- | tests/loader/basics/onefile/elements/invalidkey.bst | 3 | ||||
-rw-r--r-- | tests/loader/basics/onefile/elements/invalidsourcekey.bst | 6 |
3 files changed, 21 insertions, 0 deletions
diff --git a/tests/loader/basics.py b/tests/loader/basics.py index 4830702df..ef2a2158a 100644 --- a/tests/loader/basics.py +++ b/tests/loader/basics.py @@ -72,3 +72,15 @@ def test_fail_fullpath_target(datafiles): loader = Loader(basedir, fullpath, None, None, None, []) assert (exc.value.reason == LoadErrorReason.INVALID_DATA) + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) +def test_invalid_key(datafiles): + + basedir = os.path.join(datafiles.dirname, datafiles.basename) + loader = Loader(basedir, 'elements/invalidkey.bst', None, None, None, []) + + with pytest.raises(LoadError) as exc: + element = loader.load() + + assert (exc.value.reason == LoadErrorReason.INVALID_DATA) diff --git a/tests/loader/basics/onefile/elements/invalidkey.bst b/tests/loader/basics/onefile/elements/invalidkey.bst new file mode 100644 index 000000000..5674ab7bd --- /dev/null +++ b/tests/loader/basics/onefile/elements/invalidkey.bst @@ -0,0 +1,3 @@ +kind: pony +description: This is the pony +wings: blue diff --git a/tests/loader/basics/onefile/elements/invalidsourcekey.bst b/tests/loader/basics/onefile/elements/invalidsourcekey.bst new file mode 100644 index 000000000..5677af347 --- /dev/null +++ b/tests/loader/basics/onefile/elements/invalidsourcekey.bst @@ -0,0 +1,6 @@ +kind: pony +description: This is the pony +sources: + - kind: ponyland + url: ptp://pw.ponies.p/ + weather: great |