...

Source file src/github.com/aws/aws-sdk-go-v2/config/shared_config_other_test.go

Documentation: github.com/aws/aws-sdk-go-v2/config

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package config
     5  
     6  import (
     7  	"os"
     8  	"path/filepath"
     9  	"testing"
    10  
    11  	"github.com/aws/aws-sdk-go-v2/internal/awstesting"
    12  )
    13  
    14  func TestSharedCredsFilename(t *testing.T) {
    15  	restoreEnv := awstesting.StashEnv()
    16  	defer awstesting.PopEnv(restoreEnv)
    17  
    18  	os.Setenv("HOME", "home_dir")
    19  	os.Setenv("USERPROFILE", "profile_dir")
    20  
    21  	expect := filepath.Join("home_dir", ".aws", "credentials")
    22  
    23  	name := DefaultSharedCredentialsFilename()
    24  	if e, a := expect, name; e != a {
    25  		t.Errorf("expect %q shared creds filename, got %q", e, a)
    26  	}
    27  }
    28  
    29  func TestSharedConfigFilename(t *testing.T) {
    30  	restoreEnv := awstesting.StashEnv()
    31  	defer awstesting.PopEnv(restoreEnv)
    32  
    33  	os.Setenv("HOME", "home_dir")
    34  	os.Setenv("USERPROFILE", "profile_dir")
    35  
    36  	expect := filepath.Join("home_dir", ".aws", "config")
    37  
    38  	name := DefaultSharedConfigFilename()
    39  	if e, a := expect, name; e != a {
    40  		t.Errorf("expect %q shared config filename, got %q", e, a)
    41  	}
    42  }
    43  

View as plain text