@@ -175,7 +175,7 @@ func getExpectedFileResponseForRepofilesCreate(commitID, lastCommitSHA string) *
175175 }
176176}
177177
178- func getExpectedFileResponseForRepofilesUpdate (commitID , filename , lastCommitSHA string ) * api.FileResponse {
178+ func getExpectedFileResponseForRepofilesUpdate (commitID , filename , lastCommitSHA string , lastCommitWhen time. Time ) * api.FileResponse {
179179 encoding := "base64"
180180 content := "VGhpcyBpcyBVUERBVEVEIGNvbnRlbnQgZm9yIHRoZSBSRUFETUUgZmlsZQ=="
181181 selfURL := setting .AppURL + "api/v1/repos/user2/repo1/contents/" + filename + "?ref=master"
@@ -184,18 +184,19 @@ func getExpectedFileResponseForRepofilesUpdate(commitID, filename, lastCommitSHA
184184 downloadURL := setting .AppURL + "user2/repo1/raw/branch/master/" + filename
185185 return & api.FileResponse {
186186 Content : & api.ContentsResponse {
187- Name : filename ,
188- Path : filename ,
189- SHA : "dbf8d00e022e05b7e5cf7e535de857de57925647" ,
190- LastCommitSHA : lastCommitSHA ,
191- Type : "file" ,
192- Size : 43 ,
193- Encoding : & encoding ,
194- Content : & content ,
195- URL : & selfURL ,
196- HTMLURL : & htmlURL ,
197- GitURL : & gitURL ,
198- DownloadURL : & downloadURL ,
187+ Name : filename ,
188+ Path : filename ,
189+ SHA : "dbf8d00e022e05b7e5cf7e535de857de57925647" ,
190+ LastCommitSHA : lastCommitSHA ,
191+ LastCommitWhen : lastCommitWhen ,
192+ Type : "file" ,
193+ Size : 43 ,
194+ Encoding : & encoding ,
195+ Content : & content ,
196+ URL : & selfURL ,
197+ HTMLURL : & htmlURL ,
198+ GitURL : & gitURL ,
199+ DownloadURL : & downloadURL ,
199200 Links : & api.FileLinksResponse {
200201 Self : & selfURL ,
201202 GitURL : & gitURL ,
@@ -305,7 +306,7 @@ func TestChangeRepoFilesForUpdate(t *testing.T) {
305306
306307 commit , _ := gitRepo .GetBranchCommit (opts .NewBranch )
307308 lastCommit , _ := commit .GetCommitByPath (opts .Files [0 ].TreePath )
308- expectedFileResponse := getExpectedFileResponseForRepofilesUpdate (commit .ID .String (), opts .Files [0 ].TreePath , lastCommit .ID .String ())
309+ expectedFileResponse := getExpectedFileResponseForRepofilesUpdate (commit .ID .String (), opts .Files [0 ].TreePath , lastCommit .ID .String (), lastCommit . Committer . When )
309310 assert .EqualValues (t , expectedFileResponse .Content , filesResponse .Files [0 ])
310311 assert .EqualValues (t , expectedFileResponse .Commit .SHA , filesResponse .Commit .SHA )
311312 assert .EqualValues (t , expectedFileResponse .Commit .HTMLURL , filesResponse .Commit .HTMLURL )
@@ -341,7 +342,7 @@ func TestChangeRepoFilesForUpdateWithFileMove(t *testing.T) {
341342
342343 commit , _ := gitRepo .GetBranchCommit (opts .NewBranch )
343344 lastCommit , _ := commit .GetCommitByPath (opts .Files [0 ].TreePath )
344- expectedFileResponse := getExpectedFileResponseForRepofilesUpdate (commit .ID .String (), opts .Files [0 ].TreePath , lastCommit .ID .String ())
345+ expectedFileResponse := getExpectedFileResponseForRepofilesUpdate (commit .ID .String (), opts .Files [0 ].TreePath , lastCommit .ID .String (), lastCommit . Committer . When )
345346 // assert that the old file no longer exists in the last commit of the branch
346347 fromEntry , err := commit .GetTreeEntryByPath (opts .Files [0 ].FromTreePath )
347348 switch err .(type ) {
@@ -392,7 +393,7 @@ func TestChangeRepoFilesWithoutBranchNames(t *testing.T) {
392393
393394 commit , _ := gitRepo .GetBranchCommit (repo .DefaultBranch )
394395 lastCommit , _ := commit .GetCommitByPath (opts .Files [0 ].TreePath )
395- expectedFileResponse := getExpectedFileResponseForRepofilesUpdate (commit .ID .String (), opts .Files [0 ].TreePath , lastCommit .ID .String ())
396+ expectedFileResponse := getExpectedFileResponseForRepofilesUpdate (commit .ID .String (), opts .Files [0 ].TreePath , lastCommit .ID .String (), lastCommit . Committer . When )
396397 assert .EqualValues (t , expectedFileResponse .Content , filesResponse .Files [0 ])
397398 })
398399}
0 commit comments