Skip to content

Commit

Permalink
vendor: clean up dependencies (#173)
Browse files Browse the repository at this point in the history
* vendor: remove stray github.com/Sirupsen/logrus
* vendor: remove common lib
  • Loading branch information
arekkas authored Jun 4, 2017
1 parent 852cf82 commit 524d3b6
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 14 deletions.
3 changes: 1 addition & 2 deletions access_request_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"testing"

"github.com/golang/mock/gomock"
"github.com/ory/common/pkg"
. "github.com/ory/fosite"
"github.com/ory/fosite/internal"
"github.com/pkg/errors"
Expand Down Expand Up @@ -188,7 +187,7 @@ func TestNewAccessRequest(t *testing.T) {
if err != nil {
t.Logf("Error occured: %v", err)
} else {
pkg.AssertObjectKeysEqual(t, c.expect, ar, "GrantTypes", "Client")
AssertObjectKeysEqual(t, c.expect, ar, "GrantTypes", "Client")
assert.NotNil(t, ar.GetRequestedAt())
}
t.Logf("Passed test case %d", k)
Expand Down
3 changes: 1 addition & 2 deletions authorize_request_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"context"

"github.com/golang/mock/gomock"
"github.com/ory/common/pkg"
. "github.com/ory/fosite"
. "github.com/ory/fosite/internal"
"github.com/pkg/errors"
Expand Down Expand Up @@ -172,7 +171,7 @@ func TestNewAuthorizeRequest(t *testing.T) {
if c.expectedError != nil {
assert.Equal(t, errors.Cause(err), c.expectedError, "%d: %s\n%s", k, c.desc, err)
} else {
pkg.AssertObjectKeysEqual(t, c.expect, ar, "ResponseTypes", "Scopes", "Client", "RedirectURI", "State")
AssertObjectKeysEqual(t, c.expect, ar, "ResponseTypes", "Scopes", "Client", "RedirectURI", "State")
assert.NotNil(t, ar.GetRequestedAt())
}
t.Logf("Passed test case %d", k)
Expand Down
49 changes: 49 additions & 0 deletions equalKeys.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package fosite

import "testing"
import "github.com/oleiade/reflections"
import "github.com/stretchr/testify/assert"
import "github.com/stretchr/testify/require"

func AssertObjectKeysEqual(t *testing.T, a, b interface{}, keys ...string) {
assert.True(t, len(keys) > 0, "No keys provided.")
for _, k := range keys {
c, err := reflections.GetField(a, k)
assert.Nil(t, err)
d, err := reflections.GetField(b, k)
assert.Nil(t, err)
assert.Equal(t, c, d, "%s", k)
}
}

func AssertObjectKeysNotEqual(t *testing.T, a, b interface{}, keys ...string) {
assert.True(t, len(keys) > 0, "No keys provided.")
for _, k := range keys {
c, err := reflections.GetField(a, k)
assert.Nil(t, err)
d, err := reflections.GetField(b, k)
assert.Nil(t, err)
assert.NotEqual(t, c, d, "%s", k)
}
}

func RequireObjectKeysEqual(t *testing.T, a, b interface{}, keys ...string) {
assert.True(t, len(keys) > 0, "No keys provided.")
for _, k := range keys {
c, err := reflections.GetField(a, k)
assert.Nil(t, err)
d, err := reflections.GetField(b, k)
assert.Nil(t, err)
require.Equal(t, c, d, "%s", k)
}
}
func RequireObjectKeysNotEqual(t *testing.T, a, b interface{}, keys ...string) {
assert.True(t, len(keys) > 0, "No keys provided.")
for _, k := range keys {
c, err := reflections.GetField(a, k)
assert.Nil(t, err)
d, err := reflections.GetField(b, k)
assert.Nil(t, err)
require.NotEqual(t, c, d, "%s", k)
}
}
17 changes: 17 additions & 0 deletions equalKeys_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package fosite

import "testing"

func TestAssertObjectsAreEqualByKeys(t *testing.T) {
type foo struct {
Name string
Body int
}
a := &foo{"foo", 1}
b := &foo{"bar", 1}
c := &foo{"baz", 3}

AssertObjectKeysEqual(t, a, a, "Name", "Body")
AssertObjectKeysNotEqual(t, a, b, "Name")
AssertObjectKeysNotEqual(t, a, c, "Name", "Body")
}
6 changes: 0 additions & 6 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import:
- package: golang.org/x/net
subpackages:
- context
- package: github.com/ory/common
subpackages:
- pkg
testImport:
- package: github.com/gorilla/mux
version: ~1.1.0
Expand All @@ -35,4 +32,3 @@ testImport:
- package: golang.org/x/oauth2
subpackages:
- clientcredentials
- package: github.com/Sirupsen/logrus

0 comments on commit 524d3b6

Please sign in to comment.