You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-12-15 23:41:26 +02:00
test: replace mock pkg/clock with narrowly targeted stub clocks. (#3238)
The package under pkg/clock is github.com/benbjohnson/clock, which is archived. It's also way more complex than is what is actually needed here, so we can entirely remove the dependency and remove the helper package. Fixes #2840. Signed-off-by: David Symonds <dsymonds@gmail.com>
This commit is contained in:
@@ -22,7 +22,7 @@ func TestCreatedAtNow(t *testing.T) {
|
||||
ss := &SessionState{}
|
||||
|
||||
now := time.Unix(1234567890, 0)
|
||||
ss.Clock.Set(now)
|
||||
ss.Clock = func() time.Time { return now }
|
||||
|
||||
ss.CreatedAtNow()
|
||||
g.Expect(*ss.CreatedAt).To(Equal(now))
|
||||
@@ -33,9 +33,9 @@ func TestExpiresIn(t *testing.T) {
|
||||
ss := &SessionState{}
|
||||
|
||||
now := time.Unix(1234567890, 0)
|
||||
ss.Clock.Set(now)
|
||||
ss.Clock = func() time.Time { return now }
|
||||
|
||||
ttl := time.Duration(743) * time.Second
|
||||
ttl := 743 * time.Second
|
||||
ss.ExpiresIn(ttl)
|
||||
|
||||
g.Expect(*ss.ExpiresOn).To(Equal(ss.CreatedAt.Add(ttl)))
|
||||
|
||||
Reference in New Issue
Block a user