first commit
This commit is contained in:
commit
fccfe2a4c8
26 files changed
+1819
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"ts3monolith/internal/ts3"
|
||||
)
|
||||
|
||||
func TestTokens(t *testing.T) {
|
||||
m := newTokenManager("0123456789012345678901234567890123456789")
|
||||
tok := m.clientToken("1.2.3.4", ts3.Client{ID: 7, DatabaseID: 9, Nick: "Jan", UID: "u"})
|
||||
p, err := m.verify(tok, "client", "1.2.3.4")
|
||||
if err != nil || p.ClID != 7 || p.DBID != 9 {
|
||||
t.Fatalf("verify failed: %#v %v", p, err)
|
||||
}
|
||||
if _, err := m.verify(tok, "client", "5.6.7.8"); err == nil {
|
||||
t.Fatal("expected IP mismatch")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user