@@ -50,7 +50,7 @@ func getCreateFileOptions() api.CreateFileOptions {
5050 }
5151}
5252
53- func getExpectedFileResponseForCreate (repoFullName , commitID , treePath , latestCommitSHA string ) * api.FileResponse {
53+ func getExpectedFileResponseForCreate (repoFullName , commitID , treePath , latestCommitSHA string , latestCommitWhen time. Time ) * api.FileResponse {
5454 sha := "a635aa942442ddfdba07468cf9661c08fbdf0ebf"
5555 encoding := "base64"
5656 content := "VGhpcyBpcyBuZXcgdGV4dA=="
@@ -60,18 +60,19 @@ func getExpectedFileResponseForCreate(repoFullName, commitID, treePath, latestCo
6060 downloadURL := setting .AppURL + repoFullName + "/raw/branch/master/" + treePath
6161 return & api.FileResponse {
6262 Content : & api.ContentsResponse {
63- Name : filepath .Base (treePath ),
64- Path : treePath ,
65- SHA : sha ,
66- LastCommitSHA : latestCommitSHA ,
67- Size : 16 ,
68- Type : "file" ,
69- Encoding : & encoding ,
70- Content : & content ,
71- URL : & selfURL ,
72- HTMLURL : & htmlURL ,
73- GitURL : & gitURL ,
74- DownloadURL : & downloadURL ,
63+ Name : filepath .Base (treePath ),
64+ Path : treePath ,
65+ SHA : sha ,
66+ LastCommitSHA : latestCommitSHA ,
67+ LastCommitWhen : latestCommitWhen ,
68+ Size : 16 ,
69+ Type : "file" ,
70+ Encoding : & encoding ,
71+ Content : & content ,
72+ URL : & selfURL ,
73+ HTMLURL : & htmlURL ,
74+ GitURL : & gitURL ,
75+ DownloadURL : & downloadURL ,
7576 Links : & api.FileLinksResponse {
7677 Self : & selfURL ,
7778 GitURL : & gitURL ,
@@ -170,7 +171,7 @@ func TestAPICreateFile(t *testing.T) {
170171 gitRepo , _ := gitrepo .OpenRepository (stdCtx .Background (), repo1 )
171172 commitID , _ := gitRepo .GetBranchCommitID (createFileOptions .NewBranchName )
172173 latestCommit , _ := gitRepo .GetCommitByPath (treePath )
173- expectedFileResponse := getExpectedFileResponseForCreate ("user2/repo1" , commitID , treePath , latestCommit .ID .String ())
174+ expectedFileResponse := getExpectedFileResponseForCreate ("user2/repo1" , commitID , treePath , latestCommit .ID .String (), latestCommit . Committer . When )
174175 var fileResponse api.FileResponse
175176 DecodeJSON (t , resp , & fileResponse )
176177 assert .EqualValues (t , expectedFileResponse .Content , fileResponse .Content )
@@ -288,7 +289,7 @@ func TestAPICreateFile(t *testing.T) {
288289 gitRepo , _ := gitrepo .OpenRepository (stdCtx .Background (), emptyRepo )
289290 commitID , _ := gitRepo .GetBranchCommitID (createFileOptions .NewBranchName )
290291 latestCommit , _ := gitRepo .GetCommitByPath (treePath )
291- expectedFileResponse := getExpectedFileResponseForCreate ("user2/empty-repo" , commitID , treePath , latestCommit .ID .String ())
292+ expectedFileResponse := getExpectedFileResponseForCreate ("user2/empty-repo" , commitID , treePath , latestCommit .ID .String (), latestCommit . Committer . When )
292293 DecodeJSON (t , resp , & fileResponse )
293294 assert .EqualValues (t , expectedFileResponse .Content , fileResponse .Content )
294295 assert .EqualValues (t , expectedFileResponse .Commit .SHA , fileResponse .Commit .SHA )
0 commit comments