diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2019-08-15 12:53:28 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-08-15 18:53:28 +0800 |
commit | c2c35d169c819439b78c8c2c7f8877e7bf053cd1 (patch) | |
tree | 03e5d7379c4fb7a3763d84784f39c5a84a144a19 /integrations/api_repo_lfs_locks_test.go | |
parent | a077c9d551904aec8bebb3bbeadab1361c3611f4 (diff) | |
download | gitea-c2c35d169c819439b78c8c2c7f8877e7bf053cd1.tar.gz gitea-c2c35d169c819439b78c8c2c7f8877e7bf053cd1.zip |
lfs/lock: round locked_at timestamp to second (#7872)
* lfs/lock: round locked_at timestamp to second
* test returned locked_at values
* tests: use time RFC3339
Diffstat (limited to 'integrations/api_repo_lfs_locks_test.go')
-rw-r--r-- | integrations/api_repo_lfs_locks_test.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/integrations/api_repo_lfs_locks_test.go b/integrations/api_repo_lfs_locks_test.go index 657933dd5c..6c0aeb1152 100644 --- a/integrations/api_repo_lfs_locks_test.go +++ b/integrations/api_repo_lfs_locks_test.go @@ -104,8 +104,11 @@ func TestAPILFSLocksLogged(t *testing.T) { req := NewRequestWithJSON(t, "POST", fmt.Sprintf("/%s.git/info/lfs/locks", test.repo.FullName()), map[string]string{"path": test.path}) req.Header.Set("Accept", "application/vnd.git-lfs+json") req.Header.Set("Content-Type", "application/vnd.git-lfs+json") - session.MakeRequest(t, req, test.httpResult) + resp := session.MakeRequest(t, req, test.httpResult) if len(test.addTime) > 0 { + var lfsLock api.LFSLockResponse + DecodeJSON(t, resp, &lfsLock) + assert.EqualValues(t, lfsLock.Lock.LockedAt.Format(time.RFC3339), lfsLock.Lock.LockedAt.Format(time.RFC3339Nano)) //locked at should be rounded to second for _, id := range test.addTime { resultsTests[id].locksTimes = append(resultsTests[id].locksTimes, time.Now()) } @@ -124,6 +127,7 @@ func TestAPILFSLocksLogged(t *testing.T) { for i, lock := range lfsLocks.Locks { assert.EqualValues(t, test.locksOwners[i].DisplayName(), lock.Owner.Name) assert.WithinDuration(t, test.locksTimes[i], lock.LockedAt, 3*time.Second) + assert.EqualValues(t, lock.LockedAt.Format(time.RFC3339), lock.LockedAt.Format(time.RFC3339Nano)) //locked at should be rounded to second } req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/%s.git/info/lfs/locks/verify", test.repo.FullName()), map[string]string{}) |