blob: e35dcea954e626e5533679425cee9f68434fa79f (
plain)
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
|
package auth
import (
"crypto/tls"
"net/http"
"testing"
)
func TestHTTP(t *testing.T) {
want := "http://example.com/auth/callback"
r := &http.Request{
Host: "example.com",
}
ret := Oauth2RedirectURL(r)
if want != ret {
t.Errorf("Wanted %s, got %s", want, ret)
}
}
func TestHTTPS(t *testing.T) {
want := "https://example.com/auth/callback"
r := &http.Request{
Host: "example.com",
TLS: &tls.ConnectionState{},
}
ret := Oauth2RedirectURL(r)
if want != ret {
t.Errorf("Wanted %s, got %s", want, ret)
}
}
|