Skip to content

Commit

Permalink
WIP: ACL Test for Operator token.
Browse files Browse the repository at this point in the history
  • Loading branch information
lhaig committed May 15, 2022
1 parent afd477a commit ea95624
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions api/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,37 @@ func TestACL_OneTimeToken(t *testing.T) {
assert.NotNil(t, out3)
assert.Equal(t, out3.AccessorID, out.AccessorID)
}

func TestACLTokens_BootstrapInvalidToken(t *testing.T) {
testutil.Parallel(t)
c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) {
c.ACL.Enabled = true
})
defer s.Stop()
at := c.ACLTokens()

bootkn := BootstrapRequest{}
bootkn.Secret = "badtoken"
// Bootstrap with invalid token
out, wm, err := at.Bootstrap(&bootkn, nil)
assert.NotNil(t, err)
assertWriteMeta(t, wm)
assert.NotNil(t, out)
}

func TestACLTokens_BootstrapValidToken(t *testing.T) {
testutil.Parallel(t)
c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) {
c.ACL.Enabled = true
})
defer s.Stop()
at := c.ACLTokens()

bootkn := BootstrapRequest{}
bootkn.Secret = "2b778dd9-f5f1-6f29-b4b4-9a5fa948757a"
// Bootstrap with Valid token
out, wm, err := at.Bootstrap(&bootkn, nil)
assert.Nil(t, err)
assertWriteMeta(t, wm)
assert.Equal(t, bootkn.Secret, out.SecretID)
}

0 comments on commit ea95624

Please sign in to comment.