github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/worker/uniter/runner/jujuc/secret-ids_test.go (about)

     1  // Copyright 2022 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package jujuc_test
     5  
     6  import (
     7  	"github.com/juju/cmd/v3"
     8  	"github.com/juju/cmd/v3/cmdtesting"
     9  	jc "github.com/juju/testing/checkers"
    10  	gc "gopkg.in/check.v1"
    11  
    12  	"github.com/juju/juju/worker/uniter/runner/jujuc"
    13  )
    14  
    15  type SecretIdsSuite struct {
    16  	ContextSuite
    17  }
    18  
    19  var _ = gc.Suite(&SecretIdsSuite{})
    20  
    21  func (s *SecretIdsSuite) TestSecretIds(c *gc.C) {
    22  	hctx, _ := s.ContextSuite.NewHookContext()
    23  
    24  	com, err := jujuc.NewCommand(hctx, "secret-ids")
    25  	c.Assert(err, jc.ErrorIsNil)
    26  	ctx := cmdtesting.Context(c)
    27  	code := cmd.Main(jujuc.NewJujucCommandWrappedForTest(com), ctx, nil)
    28  
    29  	c.Assert(code, gc.Equals, 0)
    30  	s.Stub.CheckCallNames(c, "SecretMetadata")
    31  	c.Assert(bufferString(ctx.Stdout), gc.Equals, "9m4e2mr0ui3e8a215n4g\n")
    32  }