summaryrefslogtreecommitdiff
path: root/testing/02-commands-keyring.yarn
blob: a458f3da554a943c43d25c2389453770eda5380f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!-- -*- markdown -*- -->

`keyring [list|show...]
=======================

The `keyring` command allows for the (delegable) management of keyrings in the
`gitano-admin.git` repository.

Basic operation
===============

Firstly, we ensure that with a standard instance, there are no keyrings.  As
a gitano-admin we have full access to the keyrings by default...

    SCENARIO Verify empty keyring set

    GIVEN a standard instance
     WHEN testinstance adminkey runs keyring list
     THEN stdout is empty
      AND stderr is empty

    FINALLY the instance is torn down

Now let's check that we can create a keyring and it'll show, and vanish again
when we remove it.

    SCENARIO Verify keyrings come and go

    GIVEN a standard instance
     WHEN testinstance adminkey runs keyring create jeff
      AND testinstance adminkey runs keyring list
     THEN stdout contains jeff
      AND stderr is empty
     WHEN testinstance adminkey runs keyring destroy jeff --force
      AND testinstance adminkey runs keyring list
     THEN stdout is empty
      AND stderr is empty

    FINALLY the instance is torn down

More complex keyring operations
===============================

Now let's check that we can add our test key to the keyring.  Our test key has
the fingerprint `32CD66C9C4E07D2D2A48B9D8DAEE518EFD8A5932` and is available
from our test GPG home.

    SCENARIO Keyrings can gain and lose keys

    GIVEN a standard instance
     WHEN testinstance adminkey runs keyring create jeff
      AND testinstance adminkey runs keyring list
     THEN stdout contains jeff
      AND stderr is empty
    GIVEN gpg key 32CD66C9C4E07D2D2A48B9D8DAEE518EFD8A5932 on stdin
     WHEN testinstance adminkey runs keyring import jeff
      AND testinstance adminkey runs keyring show jeff
     THEN stdout contains 32CD66C9C4E07D2D2A48B9D8DAEE518EFD8A5932
      AND stderr is empty
     WHEN testinstance adminkey runs keyring delkey jeff 32CD66C9C4E07D2D2A48B9D8DAEE518EFD8A5932 --force
      AND testinstance adminkey runs keyring show jeff
     THEN stdout is empty
      AND stderr is empty

    FINALLY the instance is torn down

FIXME: Now that we have the ability to patch the rules we should add more tests
NOTE: We should also look at hooks for validating keyrings and so on.