Skip to content

Commit

Permalink
Format time to string for storage
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmrod committed Jul 29, 2022
1 parent 21464cb commit bb4cb0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion storage/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ ON DUPLICATE KEY UPDATE
tokens.ConsumerSecret,
tokens.AccessToken,
tokens.AccessSecret,
tokens.AccessTokenExpiry,
tokens.AccessTokenExpiry.Format(timestampFormat),
)
return err
}
Expand Down
3 changes: 2 additions & 1 deletion storage/storagetest/storagetest.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ func checkTokens(t *testing.T, t1 *client.OAuth1Tokens, t2 *client.OAuth1Tokens)
if t1.AccessSecret != t2.AccessSecret {
t.Fatalf("tokens access_secret mismatch: %s vs. %s", t1.AccessSecret, t2.AccessSecret)
}
if t1.AccessTokenExpiry.Round(time.Second) != t2.AccessTokenExpiry.Round(time.Second) {
diff := t1.AccessTokenExpiry.Sub(t2.AccessTokenExpiry)
if diff > 1*time.Second || diff < -1*time.Second {
t.Fatalf("tokens expiry mismatch: %s vs. %s", t1.AccessTokenExpiry, t2.AccessTokenExpiry)
}
}
Expand Down

0 comments on commit bb4cb0f

Please sign in to comment.