From 5778cfc82a0308cf84d4a9365ea3a05a963795c6 Mon Sep 17 00:00:00 2001 From: Alberto Ricart Date: Fri, 31 May 2024 15:39:22 -0500 Subject: [PATCH] [TEST] tests for #652 (#654) --- cmd/deleteuser_test.go | 40 ++++++++++++++++++------------------- cmd/describeaccount_test.go | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cmd/deleteuser_test.go b/cmd/deleteuser_test.go index f73f0f9f..8dc633db 100644 --- a/cmd/deleteuser_test.go +++ b/cmd/deleteuser_test.go @@ -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) +} diff --git a/cmd/describeaccount_test.go b/cmd/describeaccount_test.go index 82a009d8..bec80c1a 100644 --- a/cmd/describeaccount_test.go +++ b/cmd/describeaccount_test.go @@ -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")