-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtool_test.go
More file actions
32 lines (27 loc) · 761 Bytes
/
Copy pathtool_test.go
File metadata and controls
32 lines (27 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package social
import (
"strings"
"testing"
)
// TestCodeChallenge: Test the codeChallenge func.
func TestCodeChallenge(t *testing.T) {
codeVerifier := "wJKN8qz5t8SSI9lMFhBB6qwNkQBkuPZoCxzRhwLRUo1"
wantChan := "BSCQwo_m8Wf0fpjmwkIKmPAJ1A7tiuRSNDnXzODS7QI"
codeChanllege := PkceChallenge(codeVerifier)
if codeChanllege != wantChan {
t.Errorf("CodeChannlege Error: \ncodeChan=%s\nwantChan=%s\n", codeChanllege, wantChan)
}
}
func TestCodeVerifier(t *testing.T) {
cv1, err := GenerateCodeVerifier(0)
if err != nil {
t.Errorf("GenerateCodeVerifier Error: %v", err)
return
}
if len(cv1) != 43 {
t.Errorf("CodeVerifier Error: \ncodeVer=%s\n", cv1)
}
if strings.Contains(cv1, "=") {
t.Errorf("CodeVerifier Error: \ncodeVer=%s\n", cv1)
}
}