auth

Paddy 2014-07-18

0:7a6f64db7246 Go to Latest

auth/urivalidate_test.go

Start rewriting the repo. This code originally was a carbon copy of https://github.com/RangelReale/osin, but I am methodically stripping out the extensible nature of it for a simpler interface, while simultaneously bringing the style into line with the Ducky style.

History
1 package oauth2
3 import (
4 "testing"
5 )
7 func TestURIValidate(t *testing.T) {
8 // V1
9 if err := ValidateUri("http://localhost:14000/appauth", "http://localhost:14000/appauth"); err != nil {
10 t.Errorf("V1: %s", err)
11 }
13 // V2
14 if err := ValidateUri("http://localhost:14000/appauth", "http://localhost:14000/app"); err == nil {
15 t.Error("V2 should have failed")
16 }
18 // V3
19 if err := ValidateUri("http://www.google.com/myapp", "http://www.google.com/myapp/interface/implementation"); err != nil {
20 t.Errorf("V3: %s", err)
21 }
23 // V4
24 if err := ValidateUri("http://www.google.com/myapp", "http://www2.google.com/myapp"); err == nil {
25 t.Error("V4 should have failed")
26 }
27 }