diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-26 14:56:00 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-26 15:33:09 +0200 |
| commit | 3137edfa7f576f058d120dfd8ec1037d16289e6d (patch) | |
| tree | 01bb31228165dea092fe05e777d6a6d05fe1e997 /internal/oauth | |
| parent | 7e4494256a08f585523e01b1bbc51f41ff4e2b95 (diff) | |
OAuth: Add verifier tests
Diffstat (limited to 'internal/oauth')
| -rw-r--r-- | internal/oauth/oauth_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/oauth/oauth_test.go b/internal/oauth/oauth_test.go new file mode 100644 index 0000000..2427220 --- /dev/null +++ b/internal/oauth/oauth_test.go @@ -0,0 +1,24 @@ +package oauth + +import ( + "net/url" + "testing" +) + +func Test_verifiergen(t *testing.T) { + verifier, verifierErr := genVerifier() + if verifierErr != nil { + t.Fatalf("Gen verifier error: %v", verifierErr) + } + + // Verifier must be at minimum 43 and at max 128 characters... + // However... Our verifier is exactly 43! + if len(verifier) != 43 { + t.Fatalf("Got verifier length: %d, want a verifier with at least 43 characters", len(verifier)) + } + + _, unescapeErr := url.QueryUnescape(verifier) + if unescapeErr != nil { + t.Fatalf("Verifier: %s can not be unescaped", verifier) + } +} |
