mirror of
https://gitlab.durp.info/durfy/apps/durpcli.git
synced 2026-05-08 00:11:28 -05:00
24 lines
356 B
Go
24 lines
356 B
Go
|
|
package auth
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os/user"
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"github.com/zalando/go-keyring"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestGetToken(t *testing.T) {
|
||
|
|
|
||
|
|
keyring.MockInit()
|
||
|
|
user, _ := user.Current()
|
||
|
|
err := keyring.Set("durpcli", user.Username, "password")
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
token := gettoken()
|
||
|
|
if token != "password" {
|
||
|
|
t.Error("password was not expected string")
|
||
|
|
}
|
||
|
|
}
|