File: op_test.go

package info (click to toggle)
golang-github-openpubkey-openpubkey 0.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 964 kB
  • sloc: makefile: 10
file content (20 lines) | stat: -rw-r--r-- 385 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package providers

import (
	"os"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestGetEnvVar(t *testing.T) {
	originalEnv := os.Getenv("TEST_ENV_VAR")
	os.Setenv("TEST_ENV_VAR", "test value")
	defer os.Setenv("TEST_ENV_VAR", originalEnv)

	_, err := getEnvVar("TEST_ENV_VAR")
	require.NoError(t, err)

	_, err = getEnvVar("NON_EXISTENT_ENV_VAR")
	require.Error(t, err)
}