Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeneas Rekkas (arekkas) committed Oct 25, 2016
1 parent dbc295e commit b3904f5
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 11 deletions.
8 changes: 4 additions & 4 deletions client/client_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package client

import (
"testing"
"github.com/ory-am/fosite"
"github.com/stretchr/testify/assert"
"testing"
)

func TestClient(t *testing.T) {
c := &Client{
ID: "foo",
ID: "foo",
RedirectURIs: []string{"foo"},
Scope: "foo bar",
Scope: "foo bar",
}

assert.EqualValues(t, c.RedirectURIs, c.GetRedirectURIs())
Expand All @@ -21,4 +21,4 @@ func TestClient(t *testing.T) {
assert.EqualValues(t, (c.Public), c.IsPublic())
assert.Len(t, c.GetScopes(), 2)
assert.EqualValues(t, c.RedirectURIs, c.GetRedirectURIs())
}
}
2 changes: 1 addition & 1 deletion client/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/ory-am/dockertest"
"github.com/ory-am/fosite"
. "github.com/ory-am/hydra/client"
"github.com/ory-am/hydra/herodot"
"github.com/ory-am/hydra/compose"
"github.com/ory-am/hydra/herodot"
"github.com/ory-am/hydra/pkg"
"github.com/ory-am/ladon"
"github.com/pborman/uuid"
Expand Down
2 changes: 1 addition & 1 deletion cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestExecute(t *testing.T) {
{args: []string{"policies", "policies", "actions", "delete", "update|create"}},
{args: []string{"policies", "policies", "resources", "add", "printer"}},
{args: []string{"policies", "policies", "resources", "delete", "printer"}},
{args: []string{"policies", "policies", "subjects", "add", "foobar", "ken", "tracy"}},
{args: []string{"policies", "policies", "subjects", "add", "foobar", "ken", "tracy"}},
{args: []string{"policies", "policies", "subjects", "delete", "foobar", "ken", "tracy"}},
{args: []string{"policies", "get", "foobar"}},
{args: []string{"policies", "delete", "foobar"}},
Expand Down
2 changes: 1 addition & 1 deletion jwk/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/julienschmidt/httprouter"
"github.com/ory-am/dockertest"
"github.com/ory-am/fosite"
"github.com/ory-am/hydra/herodot"
"github.com/ory-am/hydra/compose"
"github.com/ory-am/hydra/herodot"
. "github.com/ory-am/hydra/jwk"
"github.com/ory-am/hydra/pkg"
"github.com/ory-am/ladon"
Expand Down
2 changes: 1 addition & 1 deletion oauth2/fosite_store_rethinkdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (s *FositeRehinkDBStore) publishDelete(table r.Term, id string) error {
return nil
}

func (s *FositeRehinkDBStore) waitFor(i RDBItems, id string) error {
func (s *FositeRehinkDBStore) waitFor(i RDBItems, id string) error {
c := make(chan bool)

go func() {
Expand Down
26 changes: 26 additions & 0 deletions oauth2/handler_consent_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package oauth2

import (
"net/http/httptest"
"net/http"
"io/ioutil"
"github.com/julienschmidt/httprouter"
"github.com/stretchr/testify/assert"
"testing"
)

func TestHandlerConsent(t *testing.T) {
h := new(Handler)
r := httprouter.New()
h.SetRoutes(r)
ts := httptest.NewServer(r)

res, err := http.Get(ts.URL + "/oauth2/consent")
assert.Nil(t, err)
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
assert.Nil(t, err)

assert.NotEmpty(t, body)
}
2 changes: 1 addition & 1 deletion policy/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/julienschmidt/httprouter"
"github.com/ory-am/fosite"
"github.com/ory-am/hydra/herodot"
"github.com/ory-am/hydra/compose"
"github.com/ory-am/hydra/herodot"
"github.com/ory-am/hydra/pkg"
"github.com/ory-am/ladon"
"github.com/pborman/uuid"
Expand Down
4 changes: 2 additions & 2 deletions sdk/client_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package sdk

import (
"testing"
"github.com/stretchr/testify/assert"
"testing"
)

func TestConnect(t *testing.T) {
Expand All @@ -12,4 +12,4 @@ func TestConnect(t *testing.T) {
ClusterURL("https://localhost:4444"),
)
assert.NotNil(t, err)
}
}

0 comments on commit b3904f5

Please sign in to comment.