diff options
author | 6543 <6543@obermui.de> | 2019-12-24 03:33:52 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-24 10:33:52 +0800 |
commit | 40e99ea010b3b0be241be0e1365a70d33777bcf2 (patch) | |
tree | cc7930e51a8ed41fcb183dae075d7ab211d06834 /integrations | |
parent | 017f314b5a0f930b477efa1c2a5309f8cdd6d3c3 (diff) | |
download | gitea-40e99ea010b3b0be241be0e1365a70d33777bcf2.tar.gz gitea-40e99ea010b3b0be241be0e1365a70d33777bcf2.zip |
[API] Extend contents with dates (#9464)
* extend CommitTree func
* make sure Date NOT nil
* spell corection
Co-Authored-By: zeripath <art27@cantab.net>
* add TEST
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_repo_file_create_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/integrations/api_repo_file_create_test.go b/integrations/api_repo_file_create_test.go index 53042b5d0a..3c8b50d5d1 100644 --- a/integrations/api_repo_file_create_test.go +++ b/integrations/api_repo_file_create_test.go @@ -11,6 +11,7 @@ import ( "net/url" "path/filepath" "testing" + "time" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" @@ -37,6 +38,10 @@ func getCreateFileOptions() api.CreateFileOptions { Name: "John Doe", Email: "johndoe@example.com", }, + Dates: api.CommitDateOptions{ + Author: time.Unix(946684810, 0), + Committer: time.Unix(978307190, 0), + }, }, Content: contentEncoded, } @@ -80,12 +85,14 @@ func getExpectedFileResponseForCreate(commitID, treePath string) *api.FileRespon Name: "Anne Doe", Email: "annedoe@example.com", }, + Date: "2000-01-01T00:00:10Z", }, Committer: &api.CommitUser{ Identity: api.Identity{ Name: "John Doe", Email: "johndoe@example.com", }, + Date: "2000-12-31T23:59:50Z", }, Message: "Updates README.md\n", }, @@ -139,6 +146,10 @@ func TestAPICreateFile(t *testing.T) { assert.EqualValues(t, expectedFileResponse.Commit.HTMLURL, fileResponse.Commit.HTMLURL) assert.EqualValues(t, expectedFileResponse.Commit.Author.Email, fileResponse.Commit.Author.Email) assert.EqualValues(t, expectedFileResponse.Commit.Author.Name, fileResponse.Commit.Author.Name) + assert.EqualValues(t, expectedFileResponse.Commit.Author.Date, fileResponse.Commit.Author.Date) + assert.EqualValues(t, expectedFileResponse.Commit.Committer.Email, fileResponse.Commit.Committer.Email) + assert.EqualValues(t, expectedFileResponse.Commit.Committer.Name, fileResponse.Commit.Committer.Name) + assert.EqualValues(t, expectedFileResponse.Commit.Committer.Date, fileResponse.Commit.Committer.Date) gitRepo.Close() } |