summaryrefslogtreecommitdiff
path: root/testing/02-commands-destroy.yarn
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2017-01-02 14:27:57 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2017-01-02 14:27:57 +0000
commite2d36d9ea5b0ff1b59b33300c2174b95b9d1b562 (patch)
tree466dbfaeefbb081ebf7c5588ecf203022b7712a3 /testing/02-commands-destroy.yarn
parent2b35f1709bfafc56fc5f9c416da277ba63c61e43 (diff)
downloadgitano-e2d36d9ea5b0ff1b59b33300c2174b95b9d1b562.tar.gz
Complete cleanups that Richard started
Diffstat (limited to 'testing/02-commands-destroy.yarn')
-rw-r--r--testing/02-commands-destroy.yarn56
1 files changed, 29 insertions, 27 deletions
diff --git a/testing/02-commands-destroy.yarn b/testing/02-commands-destroy.yarn
index 9ea9a44..da2d74f 100644
--- a/testing/02-commands-destroy.yarn
+++ b/testing/02-commands-destroy.yarn
@@ -1,16 +1,17 @@
<!-- -*- markdown -*- -->
- SCENARIO repository destruction
- GIVEN a standard instance
- AND testinstance using adminkey has patched gitano-admin with personal-repo-create.patch
- AND a unix user called alice
- AND alice has keys called main
- WHEN testinstance, using adminkey, adds user alice, using alice main
+ SCENARIO repository destruction
+
+ GIVEN a standard instance
+ AND testinstance using adminkey has patched gitano-admin with personal-repo-create.patch
+ AND a unix user called alice
+ AND alice has keys called main
+ WHEN testinstance, using adminkey, adds user alice, using alice main
We obviously can't destroy a repository that doesn't exist.
- WHEN alice main, expecting failure, runs destroy personal/alice/testrepo --force
- THEN stderr contains ERROR: Cannot destroy a repository which does not exist
+ WHEN alice main, expecting failure, runs destroy personal/alice/testrepo --force
+ THEN stderr contains ERROR: Cannot destroy a repository which does not exist
But the error message must be helpful and not an information leak.
So if the user is permitted to know that repository exists
@@ -18,18 +19,18 @@ we can tell them that it failed because it does not exist,
but if the user is not permitted to know the repository exists,
then we must tell them it failed because they weren't permitted.
- WHEN alice main, expecting failure, runs destroy gitano-admin --force
- THEN stderr does not contain ERROR: Cannot destroy a repository which does not exist
- AND stderr contains CRIT: You may not destroy repositories you do not own
+ WHEN alice main, expecting failure, runs destroy gitano-admin --force
+ THEN stderr does not contain ERROR: Cannot destroy a repository which does not exist
+ AND stderr contains CRIT: You may not destroy repositories you do not own
Repositories writable by the user can be destroyed by the user.
- WHEN alice main runs create personal/alice/testrepo
- AND alice main runs ls
- THEN stdout contains personal/alice/testrepo
- WHEN alice main runs destroy personal/alice/testrepo --force
- AND alice main runs ls
- THEN stdout does not contain personal/alice/testrepo
+ WHEN alice main runs create personal/alice/testrepo
+ AND alice main runs ls
+ THEN stdout contains personal/alice/testrepo
+ WHEN alice main runs destroy personal/alice/testrepo --force
+ AND alice main runs ls
+ THEN stdout does not contain personal/alice/testrepo
Use of `--force` is dangerous as the user has no way of knowing
whether another user pushed to the repository since they last used it.
@@ -37,17 +38,18 @@ whether another user pushed to the repository since they last used it.
If not passed then the first time a destroy is attempted it provides a token,
which will do the delete if the token is still valid when passed to destroy.
- WHEN alice main runs create personal/alice/testrepo
- AND alice main runs ls
- THEN stdout contains personal/alice/testrepo
- WHEN alice main runs destroy personal/alice/testrepo
- THEN stdout contains re-run your command with the following confirmation token
- GIVEN the token is saved as delete
- WHEN testinstance adminkey runs config personal/alice/testrepo set project.description Foo
- AND alice using main, expecting failure, destroys personal/alice/testrepo using the delete token
- THEN stderr contains ERROR: Confirmation token does not match, refusing to destroy
+ WHEN alice main runs create personal/alice/testrepo
+ AND alice main runs ls
+ THEN stdout contains personal/alice/testrepo
+ WHEN alice main runs destroy personal/alice/testrepo
+ THEN stdout contains re-run your command with the following confirmation token
+
+ GIVEN the token is saved as delete
+ WHEN testinstance adminkey runs config personal/alice/testrepo set project.description Foo
+ AND alice using main, expecting failure, destroys personal/alice/testrepo using the delete token
+ THEN stderr contains ERROR: Confirmation token does not match, refusing to destroy
This is to prevent deleting a repository that someone has just pushed to
and losing their changes.
- FINALLY the instance is torn down
+ FINALLY the instance is torn down