diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2016-12-16 23:18:45 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2016-12-16 23:18:45 +0000 |
commit | 8f8a48acd7804944d1b644a91699bb0516f4432d (patch) | |
tree | f02f85956fc6d187e10acda89530ac1a928c34c8 /testing | |
parent | 180db512a5987c1d0dc305651ceb9eb814f5e2b0 (diff) | |
download | gitano-8f8a48acd7804944d1b644a91699bb0516f4432d.tar.gz |
Ensure the tests actually run under HTTP mode
Diffstat (limited to 'testing')
-rw-r--r-- | testing/02-commands-help.yarn | 54 | ||||
-rw-r--r-- | testing/02-commands-sshkey.yarn | 22 | ||||
-rw-r--r-- | testing/02-commands-user.yarn | 8 | ||||
-rw-r--r-- | testing/library.yarn | 6 |
4 files changed, 51 insertions, 39 deletions
diff --git a/testing/02-commands-help.yarn b/testing/02-commands-help.yarn index 41a7e7c..670fb77 100644 --- a/testing/02-commands-help.yarn +++ b/testing/02-commands-help.yarn @@ -3,56 +3,56 @@ SCENARIO help is given GIVEN a standard instance WHEN testinstance adminkey runs help - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help admin - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help all - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help help - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help as - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help config - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help copy - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help count-objects - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help create - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help destroy - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help fsck - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help gc - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help git-receive-pack - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help git-upload-archive - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help git-upload-pack - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help graveyard - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help group - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help keyring - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help ls - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help passwd - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help readme - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help rename - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help rsync - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help sshkey - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help user - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help whoami - THEN stderr is not empty + THEN the output is not empty WHEN testinstance adminkey runs help demo - THEN stderr is not empty + THEN the output is not empty diff --git a/testing/02-commands-sshkey.yarn b/testing/02-commands-sshkey.yarn index 769ef73..5b02bb0 100644 --- a/testing/02-commands-sshkey.yarn +++ b/testing/02-commands-sshkey.yarn @@ -11,14 +11,14 @@ The key we authenticate with is displayed as part of `whoami`. This information is also shown in `sshkey list`. WHEN testinstance adminkey runs sshkey list - THEN stderr contains adminkey + THEN the output contains adminkey New keys can be added. GIVEN testinstance has keys called newkey WHEN testinstance uses their ssh public key called newkey as stdin AND testinstance adminkey runs sshkey add newkey - THEN stderr contains SSH authorised key file updated + THEN the output contains SSH authorised key file updated We should also be able to add keys with underscores and/or dashes in the tag name. @@ -26,24 +26,28 @@ name. GIVEN testinstance has keys called testkey WHEN testinstance uses their ssh public key called testkey as stdin AND testinstance adminkey runs sshkey add test-key_ - THEN stderr contains SSH authorised key file updated + THEN the output contains SSH authorised key file updated Verify the new keys are listed for the user. WHEN testinstance adminkey runs sshkey list - THEN stderr contains newkey - AND stderr contains test-key_ + THEN the output contains newkey + AND the output contains test-key_ Now that we have multiple keys assigned to a user it is necessary for gitano to be able to tell us which key is being used. +<!-- + +TODO: This section of the scenario only works in SSH mode + This is done in the `whoami` and `sshkey list` commands by appending "[*]" to the entry for the key that is in use. WHEN testinstance adminkey runs sshkey list - THEN stderr contains adminkey.*\[\*\]$ + THEN the output contains adminkey.*\[\*\]$ WHEN testinstance newkey runs sshkey list - THEN stderr contains newkey.*\[\*\]$ + THEN the output contains newkey.*\[\*\]$ This new key can be used for everything the old key can, except for removing the new key, @@ -55,7 +59,9 @@ as a protection against accidentally locking yourself out. WHEN testinstance newkey, expecting failure, runs sshkey del newkey THEN stderr contains is in use +--> + We can delete the old key and proceed with the new key in future. WHEN testinstance newkey runs sshkey del adminkey - THEN stderr contains SSH authorised key file updated + THEN the output contains SSH authorised key file updated diff --git a/testing/02-commands-user.yarn b/testing/02-commands-user.yarn index 9cf4e41..f0c0f72 100644 --- a/testing/02-commands-user.yarn +++ b/testing/02-commands-user.yarn @@ -38,8 +38,8 @@ A user's real name may also be changed. Privileged users may also rename other users. WHEN testinstance adminkey runs user rename bob robert --force - THEN stderr contains SSH authorised key file updated - AND stderr contains Committed: Rename user bob to robert + THEN the output contains SSH authorised key file updated + AND the output contains Committed: Rename user bob to robert WHEN testinstance adminkey runs user list THEN stdout contains ^robert THEN stdout does not contain ^bob @@ -47,8 +47,8 @@ Privileged users may also rename other users. Privileged users may delete other users. WHEN testinstance adminkey runs user del robert --force - THEN stderr contains SSH authorised key file updated - THEN stderr contains Committed: Delete user robert + THEN the output contains SSH authorised key file updated + THEN the output contains Committed: Delete user robert WHEN testinstance adminkey runs user list THEN stdout does not contain ^bob diff --git a/testing/library.yarn b/testing/library.yarn index 0e40fea..89d28bf 100644 --- a/testing/library.yarn +++ b/testing/library.yarn @@ -184,6 +184,12 @@ Generic utility methods IMPLEMENTS THEN ([^ ]+) is not empty grep -q . $DATADIR/"$MATCH_1" + IMPLEMENTS THEN the output is empty + if grep -q . $DATADIR/stdout $DATADIR/stderr; then false; else true; fi + + IMPLEMENTS THEN the output is not empty + grep -q . $DATADIR/stdout $DATADIR/stderr + IMPLEMENTS GIVEN the token is saved as (.+) mkdir -p "$DATADIR/saved-tokens" cat "$DATADIR/stdout" "$DATADIR/stderr" | $GTT findtoken >"$DATADIR/saved-tokens/$MATCH_1" |