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.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/urivalidate_test.go	Fri Jul 18 07:13:22 2014 -0400
     1.3 @@ -0,0 +1,27 @@
     1.4 +package oauth2
     1.5 +
     1.6 +import (
     1.7 +	"testing"
     1.8 +)
     1.9 +
    1.10 +func TestURIValidate(t *testing.T) {
    1.11 +	// V1
    1.12 +	if err := ValidateUri("http://localhost:14000/appauth", "http://localhost:14000/appauth"); err != nil {
    1.13 +		t.Errorf("V1: %s", err)
    1.14 +	}
    1.15 +
    1.16 +	// V2
    1.17 +	if err := ValidateUri("http://localhost:14000/appauth", "http://localhost:14000/app"); err == nil {
    1.18 +		t.Error("V2 should have failed")
    1.19 +	}
    1.20 +
    1.21 +	// V3
    1.22 +	if err := ValidateUri("http://www.google.com/myapp", "http://www.google.com/myapp/interface/implementation"); err != nil {
    1.23 +		t.Errorf("V3: %s", err)
    1.24 +	}
    1.25 +
    1.26 +	// V4
    1.27 +	if err := ValidateUri("http://www.google.com/myapp", "http://www2.google.com/myapp"); err == nil {
    1.28 +		t.Error("V4 should have failed")
    1.29 +	}
    1.30 +}