diff options
author | Segev Finer <segev208@gmail.com> | 2019-04-17 08:31:08 +0300 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-04-17 01:31:08 -0400 |
commit | 34548369e1d78eb1141aecd4ab02acf59f2949ae (patch) | |
tree | 77ab26b7f7c7c4e53b604a8c4eec8d2a502b4af8 /models | |
parent | 827ab6b75a70a3cd90033a4d49bb44c635dd3310 (diff) | |
download | gitea-34548369e1d78eb1141aecd4ab02acf59f2949ae.tar.gz gitea-34548369e1d78eb1141aecd4ab02acf59f2949ae.zip |
Add API for manipulating Git hooks (#6436)
* Add API for manipulating Git hooks
Signed-off-by: Segev Finer <segev@codeocean.com>
* Replace code.gitea.io/sdk with PR branch temporarily for CI
* Switch back to code.gitea.io/sdk@master
* Return 403 instead of 404 on no permission to edit hooks in API
* Add tests for Git hooks API
* Update models/repo_list_test.go
Co-Authored-By: segevfiner <segev208@gmail.com>
* Update models/repo_list_test.go
Co-Authored-By: segevfiner <segev208@gmail.com>
* empty line
Diffstat (limited to 'models')
-rw-r--r-- | models/fixtures/repo_unit.yml | 35 | ||||
-rw-r--r-- | models/fixtures/repository.yml | 11 | ||||
-rw-r--r-- | models/fixtures/user.yml | 2 | ||||
-rw-r--r-- | models/repo_list_test.go | 10 |
4 files changed, 52 insertions, 6 deletions
diff --git a/models/fixtures/repo_unit.yml b/models/fixtures/repo_unit.yml index 7a594842a8..e2bb4388d7 100644 --- a/models/fixtures/repo_unit.yml +++ b/models/fixtures/repo_unit.yml @@ -256,3 +256,38 @@ type: 3 config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}" created_unix: 1524304355 + +- + id: 38 + repo_id: 37 + type: 4 + config: "{}" + created_unix: 946684810 + +- + id: 39 + repo_id: 37 + type: 5 + config: "{}" + created_unix: 946684810 + +- + id: 40 + repo_id: 37 + type: 1 + config: "{}" + created_unix: 946684810 + +- + id: 41 + repo_id: 37 + type: 2 + config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true}" + created_unix: 946684810 + +- + id: 42 + repo_id: 37 + type: 3 + config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}" + created_unix: 946684810 diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml index 0e7f8f90db..b0fd8fcc5c 100644 --- a/models/fixtures/repository.yml +++ b/models/fixtures/repository.yml @@ -441,3 +441,14 @@ num_forks: 0 num_issues: 0 is_mirror: false + +- + id: 37 + owner_id: 2 + lower_name: git_hooks_test + name: git_hooks_test + is_private: false + num_stars: 0 + num_forks: 0 + num_issues: 0 + is_mirror: false diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml index 22e408ed25..9a1d558e6b 100644 --- a/models/fixtures/user.yml +++ b/models/fixtures/user.yml @@ -28,7 +28,7 @@ is_admin: false avatar: avatar2 avatar_email: user2@example.com - num_repos: 7 + num_repos: 8 num_stars: 2 num_followers: 2 num_following: 1 diff --git a/models/repo_list_test.go b/models/repo_list_test.go index 120718c210..96ee8821b6 100644 --- a/models/repo_list_test.go +++ b/models/repo_list_test.go @@ -147,19 +147,19 @@ func TestSearchRepositoryByName(t *testing.T) { count: 14}, {name: "AllPublic/PublicRepositoriesOfUserIncludingCollaborative", opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 15, AllPublic: true}, - count: 20}, + count: 21}, {name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborative", opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 15, Private: true, AllPublic: true}, - count: 24}, + count: 25}, {name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborativeByName", opts: &SearchRepoOptions{Keyword: "test", Page: 1, PageSize: 10, OwnerID: 15, Private: true, AllPublic: true}, - count: 14}, + count: 15}, {name: "AllPublic/PublicAndPrivateRepositoriesOfUser2IncludingCollaborativeByName", opts: &SearchRepoOptions{Keyword: "test", Page: 1, PageSize: 10, OwnerID: 18, Private: true, AllPublic: true}, - count: 12}, + count: 13}, {name: "AllPublic/PublicRepositoriesOfOrganization", opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 17, AllPublic: true, Collaborate: util.OptionalBoolFalse}, - count: 20}, + count: 21}, } for _, testCase := range testCases { |