github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/cli/command/context/inspect_test.go (about)

     1  package context
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"gotest.tools/v3/assert"
     8  	"gotest.tools/v3/golden"
     9  )
    10  
    11  func TestInspect(t *testing.T) {
    12  	cli := makeFakeCli(t)
    13  	createTestContext(t, cli, "current")
    14  	cli.OutBuffer().Reset()
    15  	assert.NilError(t, runInspect(cli, inspectOptions{
    16  		refs: []string{"current"},
    17  	}))
    18  	expected := string(golden.Get(t, "inspect.golden"))
    19  	si := cli.ContextStore().GetStorageInfo("current")
    20  	expected = strings.Replace(expected, "<METADATA_PATH>", strings.ReplaceAll(si.MetadataPath, `\`, `\\`), 1)
    21  	expected = strings.Replace(expected, "<TLS_PATH>", strings.ReplaceAll(si.TLSPath, `\`, `\\`), 1)
    22  	assert.Equal(t, cli.OutBuffer().String(), expected)
    23  }