aboutsummaryrefslogtreecommitdiff
path: root/cli_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-07-24 13:01:36 +0700
committerShulhan <ms@kilabit.info>2023-10-06 10:03:04 +0700
commit8a1a81a6428ae970569d9c2a506acf90deb2e0c4 (patch)
treed3e82e19718962181b51572a0395ed6b1cef2222 /cli_test.go
parent479e33040d93e582aa10f19c299b2633f2270d24 (diff)
downloadgotp-8a1a81a6428ae970569d9c2a506acf90deb2e0c4.tar.xz
all: unfold private key path before reading
By unfolding, user can set the path to private key using "~" that points to their home. This make the key can works across home directory, in case user have multiple homes (Linux and macOS have different home path and maybe user name, but both can use "~" as substitution for $HOME)
Diffstat (limited to 'cli_test.go')
-rw-r--r--cli_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cli_test.go b/cli_test.go
index 81253b1..5eeffd4 100644
--- a/cli_test.go
+++ b/cli_test.go
@@ -151,14 +151,15 @@ func TestCli_SetPrivateKey(t *testing.T) {
}
var (
- cli = &Cli{}
+ cli = &Cli{}
+ cfg = &config{}
+
rawConfig []byte
- cfg *config
)
rawConfig = tdata.Input[`config.ini`]
- cfg, err = loadConfig(rawConfig)
+ err = cfg.UnmarshalText(rawConfig)
if err != nil {
t.Fatal(err)
}
@@ -185,7 +186,7 @@ func TestCli_SetPrivateKey(t *testing.T) {
// Load the encrypted raw config and compare the issuer.
- cfg, err = loadConfig(rawConfig)
+ err = cfg.UnmarshalText(rawConfig)
if err != nil {
t.Fatal(err)
}