Skip to content

Commit

Permalink
extend test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
cypherhat committed Dec 20, 2018
1 parent a83010d commit f85cbda
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,4 +1,5 @@
**/releases/*
**/scripts
.DS_Store
**/.DS_Store
**/.DS_Store
**/test/*.enc
9 changes: 9 additions & 0 deletions .gitmodules
@@ -0,0 +1,9 @@
[submodule "test/test_helper/bats-support"]
path = test/test_helper/bats-support
url = https://github.com/ztombol/bats-support
[submodule "test/test_helper/bats-file"]
path = test/test_helper/bats-file
url = https://github.com/ztombol/bats-file
[submodule "test/test_helper/bats-assert"]
path = test/test_helper/bats-assert
url = https://github.com/ztombol/bats-assert
13 changes: 12 additions & 1 deletion test/claims.bats
@@ -1,5 +1,9 @@
#!/usr/bin/env bats

load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'
load 'test_helper/bats-file/load'

@test "test config" {
config="$(vault write -format=json -f nkey/config | jq .data)"
bound_cidr_list="$(echo $config | jq -r .bound_cidr_list)"
Expand Down Expand Up @@ -79,7 +83,6 @@
[ "$trusted_keys" = "$account_key" ]
}


@test "create ngs user claim" {
issuer="$(vault read -format=json nkey/identities/ngs-account | jq -r .data.public_key)"
subject="$(vault read -format=json nkey/identities/ngs-user | jq -r .data.public_key)"
Expand All @@ -91,6 +94,14 @@
[ "$subject" = "$response_subject" ]
}


@test "export ngs user creds" {
subject="$(vault read -format=json nkey/identities/ngs-user | jq -r .data.public_key)"
token="$(vault write -format=json nkey/identities/ngs-account/sign-claim subject=$subject type="user" claims=@user.json | jq -r .data.token)"
filename="$(vault write -format=json nkey/identities/ngs-user/export token=$token path=$(pwd) keybase="keybase:cypherhat" | jq -r .data.file)"
assert_file_exist $filename
}

@test "create account claim" {
issuer="$(vault read -format=json nkey/identities/operator | jq -r .data.public_key)"
subject="$(vault read -format=json nkey/identities/account | jq -r .data.public_key)"
Expand Down
1 change: 1 addition & 0 deletions test/test_helper/bats-assert
Submodule bats-assert added at 9f88b4
1 change: 1 addition & 0 deletions test/test_helper/bats-file
Submodule bats-file added at 2fddb2
1 change: 1 addition & 0 deletions test/test_helper/bats-support
Submodule bats-support added at 004e70

0 comments on commit f85cbda

Please sign in to comment.