summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecca Grayson <becky.grayson1@hotmail.co.uk>2019-08-20 17:07:29 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-09-02 10:02:24 +0100
commitd4011901434b53259b2f30b90b7ab045474596f2 (patch)
tree0c0a7e8ec87d6e0e89e30ae861cba445a24ba220 /tests
parent61468553543589056f70297cb8779200e398548a (diff)
downloadbuildstream-d4011901434b53259b2f30b90b7ab045474596f2.tar.gz
Addition of --long option to list-contents:becky/list_contents_long_option
--long or -l will provide the user with extra information about the contents of the artifacts, including permission mode, file type, size and name. In order for this to work, the way in which list-contents works has been modified. A test and NEWS entry have also been added within this commit
Diffstat (limited to 'tests')
-rw-r--r--tests/frontend/artifact_list_contents.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/frontend/artifact_list_contents.py b/tests/frontend/artifact_list_contents.py
index 5bb08e3fa..626eb3fa7 100644
--- a/tests/frontend/artifact_list_contents.py
+++ b/tests/frontend/artifact_list_contents.py
@@ -96,3 +96,45 @@ def test_artifact_list_exact_contents_glob(cli, datafiles):
for artifact in expected_artifacts:
assert artifact in result.output
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_artifact_list_exact_contents_element_long(cli, datafiles):
+ project = str(datafiles)
+
+ # Ensure we have an artifact to read
+ result = cli.run(project=project, args=['build', 'import-bin.bst'])
+ assert result.exit_code == 0
+
+ # List the contents via the element name
+ result = cli.run(project=project, args=['artifact', 'list-contents', '--long', 'import-bin.bst'])
+ assert result.exit_code == 0
+ expected_output = ("import-bin.bst:\n"
+ "\tdrwxr-xr-x dir 1 usr\n"
+ "\tdrwxr-xr-x dir 1 usr/bin\n"
+ "\t-rw-r--r-- reg 107 usr/bin/hello\n\n")
+
+ assert expected_output in result.output
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_artifact_list_exact_contents_ref_long(cli, datafiles):
+ project = str(datafiles)
+
+ # Get the cache key of our test element
+ key = cli.get_element_key(project, 'import-bin.bst')
+
+ # Ensure we have an artifact to read
+ result = cli.run(project=project, args=['build', 'import-bin.bst'])
+ assert result.exit_code == 0
+
+ # List the contents via the key
+ result = cli.run(project=project, args=['artifact', 'list-contents', '-l', 'test/import-bin/' + key])
+ assert result.exit_code == 0
+
+ expected_output = (" test/import-bin/" + key + ":\n"
+ "\tdrwxr-xr-x dir 1 usr\n"
+ "\tdrwxr-xr-x dir 1 usr/bin\n"
+ "\t-rw-r--r-- reg 107 usr/bin/hello\n\n")
+
+ assert expected_output in result.output