diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2017-11-30 17:54:43 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-12-13 13:17:28 -0500 |
commit | 3033f55d06aee5634802888aeebd3a7d0bd56e37 (patch) | |
tree | 87e043aa47cf9c36630b8d6ca175aade80278030 /tests/format/project.py | |
parent | 1171e1fb871e82292fad22830b62b69ab388ea07 (diff) | |
download | buildstream-fix-132-rebased.tar.gz |
tests: Test whether a plugin is allowed to be loadedfix-132-rebased
Diffstat (limited to 'tests/format/project.py')
-rw-r--r-- | tests/format/project.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/format/project.py b/tests/format/project.py index 5b6c474ee..e06e842e5 100644 --- a/tests/format/project.py +++ b/tests/format/project.py @@ -1,7 +1,7 @@ import os import pytest from buildstream import _yaml -from buildstream._exceptions import LoadError, LoadErrorReason +from buildstream._exceptions import LoadError, LoadErrorReason, PluginError from tests.testutils.runcli import cli @@ -13,6 +13,24 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) +def test_project_plugin_load_allowed(cli, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename, 'plugin-allowed') + result = cli.run(project=project, silent=True, args=[ + 'show', 'element.bst']) + assert result.exit_code == 0 + + +@pytest.mark.datafiles(DATA_DIR) +def test_project_plugin_load_forbidden(cli, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename, 'plugin-forbidden') + result = cli.run(project=project, silent=True, args=[ + 'show', 'element.bst']) + assert result.exit_code != 0 + assert result.exception + assert isinstance(result.exception, PluginError) + + +@pytest.mark.datafiles(DATA_DIR) def test_project_conf_duplicate_plugins(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename, 'duplicate-plugins') result = cli.run(project=project, silent=True, args=[ |