diff options
author | zeripath <art27@cantab.net> | 2019-06-22 18:35:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-22 18:35:34 +0100 |
commit | baefea311f1a66a97f9a2779ad3342f4f8167d28 (patch) | |
tree | d294d768fe141af768c7f40de6f06eb6edddfeef /integrations/api_helper_for_declarative_test.go | |
parent | d14595514e35810fbcf1dc0d7e3ba8ada4f08c07 (diff) | |
download | gitea-baefea311f1a66a97f9a2779ad3342f4f8167d28.tar.gz gitea-baefea311f1a66a97f9a2779ad3342f4f8167d28.zip |
Fix #732: Add LFS objects to base repository on merging (#7082)
On merge we walk the merge history and ensure that all lfs objects pointed to in
the history are added to the base repository. This switches from relying on having git-lfs installed on the server, (and in fact .gitattributes being correctly installed.)
Diffstat (limited to 'integrations/api_helper_for_declarative_test.go')
-rw-r--r-- | integrations/api_helper_for_declarative_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/integrations/api_helper_for_declarative_test.go b/integrations/api_helper_for_declarative_test.go index 85f0ab621f..42c271e3af 100644 --- a/integrations/api_helper_for_declarative_test.go +++ b/integrations/api_helper_for_declarative_test.go @@ -66,6 +66,44 @@ func doAPICreateRepository(ctx APITestContext, empty bool, callback ...func(*tes } } +func doAPIAddCollaborator(ctx APITestContext, username string, mode models.AccessMode) func(*testing.T) { + return func(t *testing.T) { + permission := "read" + + if mode == models.AccessModeAdmin { + permission = "admin" + } else if mode > models.AccessModeRead { + permission = "write" + } + addCollaboratorOption := &api.AddCollaboratorOption{ + Permission: &permission, + } + req := NewRequestWithJSON(t, "PUT", fmt.Sprintf("/api/v1/repos/%s/%s/collaborators/%s?token=%s", ctx.Username, ctx.Reponame, username, ctx.Token), addCollaboratorOption) + if ctx.ExpectedCode != 0 { + ctx.Session.MakeRequest(t, req, ctx.ExpectedCode) + return + } + ctx.Session.MakeRequest(t, req, http.StatusNoContent) + } +} + +func doAPIForkRepository(ctx APITestContext, username string, callback ...func(*testing.T, api.Repository)) func(*testing.T) { + return func(t *testing.T) { + createForkOption := &api.CreateForkOption{} + req := NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/forks?token=%s", username, ctx.Reponame, ctx.Token), createForkOption) + if ctx.ExpectedCode != 0 { + ctx.Session.MakeRequest(t, req, ctx.ExpectedCode) + return + } + resp := ctx.Session.MakeRequest(t, req, http.StatusAccepted) + var repository api.Repository + DecodeJSON(t, resp, &repository) + if len(callback) > 0 { + callback[0](t, repository) + } + } +} + func doAPIGetRepository(ctx APITestContext, callback ...func(*testing.T, api.Repository)) func(*testing.T) { return func(t *testing.T) { urlStr := fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", ctx.Username, ctx.Reponame, ctx.Token) |