Skip to content

Commit

Permalink
core: add tests to request state
Browse files Browse the repository at this point in the history
  • Loading branch information
budougumi0617 committed Oct 6, 2016
1 parent 39130dd commit 4bea69c
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,35 @@ func TestRequest(t *testing.T) {

assert.Equal(t, r.RequestedAt, r.GetRequestedAt())
assert.Equal(t, r.Client, r.GetClient())

assert.Equal(t, r.GrantedScopes, r.GetGrantedScopes())
assert.Equal(t, r.Scopes, r.GetRequestedScopes())
assert.Equal(t, r.Form, r.GetRequestForm())
assert.Equal(t, r.Session, r.GetSession())
}

func TestMergeRequest(t *testing.T) {
a := &Request{
RequestedAt: time.Now(),
Client: &DefaultClient{ID:"123"},
Scopes: Arguments{"asdff"},
GrantedScopes: []string{"asdf"},
Form: url.Values{"foo": []string{"fasdf"}},
Session: 54321,
}
b := &Request{
RequestedAt: time.Now(),
Client: &DefaultClient{},
Scopes: Arguments{},
GrantedScopes: []string{},
Form: url.Values{},
Session: 12345,
}

b.Merge(a)
assert.EqualValues(t, a.RequestedAt, b.RequestedAt)
assert.EqualValues(t, a.Client, b.Client)
assert.EqualValues(t, a.Scopes, b.Scopes)
assert.EqualValues(t, a.GrantedScopes, b.GrantedScopes)
assert.EqualValues(t, a.Form, b.Form)
assert.EqualValues(t, a.Session, b.Session)
}

0 comments on commit 4bea69c

Please sign in to comment.