From 098ee3cf6c742439cd48534d2a0ded6c2c1138fb Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Tue, 17 Apr 2018 17:10:07 +0900 Subject: tests/frontend/workspace.py: Added tests for force opening workspaces Guard against regressions of issue #364 --- tests/frontend/workspace.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/frontend/workspace.py') diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py index 3d87c347f..6ecc9e2d2 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -102,6 +102,27 @@ def test_open_track(cli, tmpdir, datafiles, kind): open_workspace(cli, tmpdir, datafiles, kind, True) +@pytest.mark.datafiles(DATA_DIR) +@pytest.mark.parametrize("kind", repo_kinds) +def test_open_force(cli, tmpdir, datafiles, kind): + element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, kind, False) + + # Close the workspace + result = cli.run(project=project, args=[ + 'workspace', 'close', element_name + ]) + result.assert_success() + + # Assert the workspace dir still exists + assert os.path.exists(workspace) + + # Now open the workspace again with --force, this should happily succeed + result = cli.run(project=project, args=[ + 'workspace', 'open', '--force', element_name, workspace + ]) + result.assert_success() + + @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("kind", repo_kinds) def test_close(cli, tmpdir, datafiles, kind): -- cgit v1.2.1