26 lines
700 B
Go
26 lines
700 B
Go
package verification
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
o "github.com/cli/cli/v2/pkg/option"
|
|
"github.com/cli/go-gh/v2/pkg/config"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGitHubTUFOptionsNoMetadataDir(t *testing.T) {
|
|
os.Setenv("CODESPACES", "true")
|
|
opts := GitHubTUFOptions(o.None[string](), nil)
|
|
|
|
require.Equal(t, GitHubTUFMirror, opts.RepositoryBaseURL)
|
|
require.NotNil(t, opts.Root)
|
|
require.True(t, opts.DisableLocalCache)
|
|
require.Equal(t, filepath.Join(config.CacheDir(), ".sigstore", "root"), opts.CachePath)
|
|
}
|
|
|
|
func TestGitHubTUFOptionsWithMetadataDir(t *testing.T) {
|
|
opts := GitHubTUFOptions(o.Some("anything"), nil)
|
|
require.Equal(t, "anything", opts.CachePath)
|
|
}
|