Skip to content

Commit

Permalink
client/mysql: fix missing client_name (#303)
Browse files Browse the repository at this point in the history
Signed-off-by: John Wu <johnwu96822@gmail.com>
  • Loading branch information
johnwu96822 authored and arekkas committed Nov 5, 2016
1 parent c743e37 commit b861e25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/manager_sql.go
Expand Up @@ -73,6 +73,7 @@ var sqlParams = []string{
func sqlDataFromClient(d *Client) *sqlData {
return &sqlData{
ID: d.ID,
Name: d.Name,
Secret: d.Secret,
RedirectURIs: strings.Join(d.RedirectURIs, "|"),
GrantTypes: strings.Join(d.GrantTypes, "|"),
Expand All @@ -91,6 +92,7 @@ func sqlDataFromClient(d *Client) *sqlData {
func (d *sqlData) ToClient() *Client {
return &Client{
ID: d.ID,
Name: d.Name,
Secret: d.Secret,
RedirectURIs: strings.Split(d.RedirectURIs, "|"),
GrantTypes: strings.Split(d.GrantTypes, "|"),
Expand Down
4 changes: 4 additions & 0 deletions client/manager_test.go
Expand Up @@ -283,6 +283,7 @@ func TestCreateGetDeleteClient(t *testing.T) {

c := &Client{
ID: "1234",
Name: "name",
Secret: "secret",
RedirectURIs: []string{"http://redirect"},
TermsOfServiceURI: "foo",
Expand All @@ -295,6 +296,7 @@ func TestCreateGetDeleteClient(t *testing.T) {

err = m.CreateClient(&Client{
ID: "2-1234",
Name: "name",
Secret: "secret",
RedirectURIs: []string{"http://redirect"},
TermsOfServiceURI: "foo",
Expand All @@ -317,6 +319,7 @@ func TestCreateGetDeleteClient(t *testing.T) {

err = m.UpdateClient(&Client{
ID: "2-1234",
Name: "name-new",
Secret: "secret-new",
TermsOfServiceURI: "bar",
})
Expand All @@ -331,6 +334,7 @@ func TestCreateGetDeleteClient(t *testing.T) {
assert.NotEqual(t, d.GetHashedSecret(), nc.GetHashedSecret(), "%s", k)
}
assert.Equal(t, "bar", nc.TermsOfServiceURI, "%s", k)
assert.Equal(t, "name-new", nc.Name, "%s", k)
assert.EqualValues(t, []string{"http://redirect"}, nc.GetRedirectURIs(), "%s", k)

err = m.DeleteClient("1234")
Expand Down

0 comments on commit b861e25

Please sign in to comment.