test-sha256: APICreateBranch
This commit is contained in:
parent
348182f4b3
commit
df8aaeb1d5
1 changed files with 55 additions and 54 deletions
|
@ -111,11 +111,11 @@ func TestAPICreateBranch(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAPICreateBranches(t *testing.T, giteaURL *url.URL) {
|
func testAPICreateBranches(t *testing.T, giteaURL *url.URL) {
|
||||||
username := "user2"
|
forEachObjectFormat(t, func(t *testing.T, objectFormat git.ObjectFormat) {
|
||||||
ctx := NewAPITestContext(t, username, "my-noo-repo", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
ctx := NewAPITestContext(t, "user2", "my-noo-repo-"+objectFormat.Name(), auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser)
|
||||||
giteaURL.Path = ctx.GitPath()
|
giteaURL.Path = ctx.GitPath()
|
||||||
|
|
||||||
t.Run("CreateRepo", doAPICreateRepository(ctx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat
|
t.Run("CreateRepo", doAPICreateRepository(ctx, false, objectFormat))
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
OldBranch string
|
OldBranch string
|
||||||
NewBranch string
|
NewBranch string
|
||||||
|
@ -163,9 +163,10 @@ func testAPICreateBranches(t *testing.T, giteaURL *url.URL) {
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
session := ctx.Session
|
session := ctx.Session
|
||||||
t.Run(test.NewBranch, func(t *testing.T) {
|
t.Run(test.NewBranch, func(t *testing.T) {
|
||||||
testAPICreateBranch(t, session, "user2", "my-noo-repo", test.OldBranch, test.NewBranch, test.ExpectedHTTPStatus)
|
testAPICreateBranch(t, session, ctx.Username, ctx.Reponame, test.OldBranch, test.NewBranch, test.ExpectedHTTPStatus)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAPICreateBranch(t testing.TB, session *TestSession, user, repo, oldBranch, newBranch string, status int) bool {
|
func testAPICreateBranch(t testing.TB, session *TestSession, user, repo, oldBranch, newBranch string, status int) bool {
|
||||||
|
|
Loading…
Add table
Reference in a new issue