Skip to content

Commit

Permalink
[TEST] tests for #652 (#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart authored May 31, 2024
1 parent f3aaabc commit 5778cfc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions cmd/deleteuser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,23 @@ func Test_DeleteUserFromDiffAccountInteractive(t *testing.T) {
require.True(t, os.IsNotExist(err))
}

//func Test_RevokeUserRequiresOperatorKey(t *testing.T) {
// ts := NewTestStore(t, "O")
// defer ts.Done(t)
//
// ts.AddAccount(t, "A")
// ts.AddUser(t, "A", "U")
//
// _, err := ts.Store.ReadUserClaim("A", "U")
// require.NoError(t, err)
//
// opk, err := ts.Store.GetRootPublicKey()
// require.NoError(t, err)
// require.NoError(t, ts.KeyStore.Remove(opk))
//
// _, _, err = ExecuteCmd(createDeleteUserCmd(), "--name", "U", "--revoke")
// require.Error(t, err)
//
// _, _, err = ExecuteCmd(createDeleteUserCmd(), "--name", "U")
// require.NoError(t, err)
//}
func Test_RevokeUserRequiresOperatorKey(t *testing.T) {
ts := NewTestStore(t, "O")
defer ts.Done(t)

ts.AddAccount(t, "A")
ts.AddUser(t, "A", "U")

_, err := ts.Store.ReadUserClaim("A", "U")
require.NoError(t, err)

opk, err := ts.Store.GetRootPublicKey()
require.NoError(t, err)
require.NoError(t, ts.KeyStore.Remove(opk))

_, _, err = ExecuteCmd(createDeleteUserCmd(), "--name", "U", "--revoke")
require.Error(t, err)

_, _, err = ExecuteCmd(createDeleteUserCmd(), "--name", "U")
require.NoError(t, err)
}
2 changes: 1 addition & 1 deletion cmd/describeaccount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func TestDescribeAccount_JSTiers(t *testing.T) {
require.NoError(t, err)
_, err = ts.Store.StoreClaim([]byte(token))
require.NoError(t, err)
out, _, err := ExecuteInteractiveCmd(createDescribeAccountCmd(), []interface{}{0})
out, _, err := ExecuteCmd(createDescribeAccountCmd())
require.NoError(t, err)
require.Contains(t, out, " | R1")
require.Contains(t, out, " | R3")
Expand Down

0 comments on commit 5778cfc

Please sign in to comment.