aboutsummaryrefslogtreecommitdiffstats
path: root/tests/integration
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-10-14 10:37:24 +0200
committerGitHub <noreply@github.com>2023-10-14 08:37:24 +0000
commit76a85a4ce90fead1eb2b743a42b41617b4592889 (patch)
treeef172bbbc48c24e0d95cd5c689426bad16205a69 /tests/integration
parentae419fa49403537725c806a5f3f1e5b274f52eb7 (diff)
downloadgitea-76a85a4ce90fead1eb2b743a42b41617b4592889.tar.gz
gitea-76a85a4ce90fead1eb2b743a42b41617b4592889.zip
Final round of `db.DefaultContext` refactor (#27587)
Last part of #27065
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/api_private_serv_test.go6
-rw-r--r--tests/integration/pull_merge_test.go16
2 files changed, 11 insertions, 11 deletions
diff --git a/tests/integration/api_private_serv_test.go b/tests/integration/api_private_serv_test.go
index 8beec62382..2001bb1fad 100644
--- a/tests/integration/api_private_serv_test.go
+++ b/tests/integration/api_private_serv_test.go
@@ -26,7 +26,7 @@ func TestAPIPrivateNoServ(t *testing.T) {
assert.Equal(t, int64(1), key.ID)
assert.Equal(t, "user2@localhost", key.Name)
- deployKey, err := asymkey_model.AddDeployKey(1, "test-deploy", "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBGXEEzWmm1dxb+57RoK5KVCL0w2eNv9cqJX2AGGVlkFsVDhOXHzsadS3LTK4VlEbbrDMJdoti9yM8vclA8IeRacAAAAEc3NoOg== nocomment", false)
+ deployKey, err := asymkey_model.AddDeployKey(ctx, 1, "test-deploy", "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBGXEEzWmm1dxb+57RoK5KVCL0w2eNv9cqJX2AGGVlkFsVDhOXHzsadS3LTK4VlEbbrDMJdoti9yM8vclA8IeRacAAAAEc3NoOg== nocomment", false)
assert.NoError(t, err)
key, user, err = private.ServNoCommand(ctx, deployKey.KeyID)
@@ -84,7 +84,7 @@ func TestAPIPrivateServ(t *testing.T) {
assert.Empty(t, results)
// Add reading deploy key
- deployKey, err := asymkey_model.AddDeployKey(19, "test-deploy", "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBGXEEzWmm1dxb+57RoK5KVCL0w2eNv9cqJX2AGGVlkFsVDhOXHzsadS3LTK4VlEbbrDMJdoti9yM8vclA8IeRacAAAAEc3NoOg== nocomment", true)
+ deployKey, err := asymkey_model.AddDeployKey(ctx, 19, "test-deploy", "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBGXEEzWmm1dxb+57RoK5KVCL0w2eNv9cqJX2AGGVlkFsVDhOXHzsadS3LTK4VlEbbrDMJdoti9yM8vclA8IeRacAAAAEc3NoOg== nocomment", true)
assert.NoError(t, err)
// Can pull from repo we're a deploy key for
@@ -116,7 +116,7 @@ func TestAPIPrivateServ(t *testing.T) {
assert.Empty(t, results)
// Add writing deploy key
- deployKey, err = asymkey_model.AddDeployKey(20, "test-deploy", "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBGXEEzWmm1dxb+57RoK5KVCL0w2eNv9cqJX2AGGVlkFsVDhOXHzsadS3LTK4VlEbbrDMJdoti9yM8vclA8IeRacAAAAEc3NoOg== nocomment", false)
+ deployKey, err = asymkey_model.AddDeployKey(ctx, 20, "test-deploy", "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBGXEEzWmm1dxb+57RoK5KVCL0w2eNv9cqJX2AGGVlkFsVDhOXHzsadS3LTK4VlEbbrDMJdoti9yM8vclA8IeRacAAAAEc3NoOg== nocomment", false)
assert.NoError(t, err)
// Cannot push to a private repo with reading key
diff --git a/tests/integration/pull_merge_test.go b/tests/integration/pull_merge_test.go
index f94809e4b3..a4cc3e76fe 100644
--- a/tests/integration/pull_merge_test.go
+++ b/tests/integration/pull_merge_test.go
@@ -68,7 +68,7 @@ func testPullCleanUp(t *testing.T, session *TestSession, user, repo, pullnum str
func TestPullMerge(t *testing.T) {
onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) {
- hookTasks, err := webhook.HookTasks(1, 1) // Retrieve previous hook number
+ hookTasks, err := webhook.HookTasks(db.DefaultContext, 1, 1) // Retrieve previous hook number
assert.NoError(t, err)
hookTasksLenBefore := len(hookTasks)
@@ -82,7 +82,7 @@ func TestPullMerge(t *testing.T) {
assert.EqualValues(t, "pulls", elem[3])
testPullMerge(t, session, elem[1], elem[2], elem[4], repo_model.MergeStyleMerge)
- hookTasks, err = webhook.HookTasks(1, 1)
+ hookTasks, err = webhook.HookTasks(db.DefaultContext, 1, 1)
assert.NoError(t, err)
assert.Len(t, hookTasks, hookTasksLenBefore+1)
})
@@ -90,7 +90,7 @@ func TestPullMerge(t *testing.T) {
func TestPullRebase(t *testing.T) {
onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) {
- hookTasks, err := webhook.HookTasks(1, 1) // Retrieve previous hook number
+ hookTasks, err := webhook.HookTasks(db.DefaultContext, 1, 1) // Retrieve previous hook number
assert.NoError(t, err)
hookTasksLenBefore := len(hookTasks)
@@ -104,7 +104,7 @@ func TestPullRebase(t *testing.T) {
assert.EqualValues(t, "pulls", elem[3])
testPullMerge(t, session, elem[1], elem[2], elem[4], repo_model.MergeStyleRebase)
- hookTasks, err = webhook.HookTasks(1, 1)
+ hookTasks, err = webhook.HookTasks(db.DefaultContext, 1, 1)
assert.NoError(t, err)
assert.Len(t, hookTasks, hookTasksLenBefore+1)
})
@@ -112,7 +112,7 @@ func TestPullRebase(t *testing.T) {
func TestPullRebaseMerge(t *testing.T) {
onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) {
- hookTasks, err := webhook.HookTasks(1, 1) // Retrieve previous hook number
+ hookTasks, err := webhook.HookTasks(db.DefaultContext, 1, 1) // Retrieve previous hook number
assert.NoError(t, err)
hookTasksLenBefore := len(hookTasks)
@@ -126,7 +126,7 @@ func TestPullRebaseMerge(t *testing.T) {
assert.EqualValues(t, "pulls", elem[3])
testPullMerge(t, session, elem[1], elem[2], elem[4], repo_model.MergeStyleRebaseMerge)
- hookTasks, err = webhook.HookTasks(1, 1)
+ hookTasks, err = webhook.HookTasks(db.DefaultContext, 1, 1)
assert.NoError(t, err)
assert.Len(t, hookTasks, hookTasksLenBefore+1)
})
@@ -134,7 +134,7 @@ func TestPullRebaseMerge(t *testing.T) {
func TestPullSquash(t *testing.T) {
onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) {
- hookTasks, err := webhook.HookTasks(1, 1) // Retrieve previous hook number
+ hookTasks, err := webhook.HookTasks(db.DefaultContext, 1, 1) // Retrieve previous hook number
assert.NoError(t, err)
hookTasksLenBefore := len(hookTasks)
@@ -149,7 +149,7 @@ func TestPullSquash(t *testing.T) {
assert.EqualValues(t, "pulls", elem[3])
testPullMerge(t, session, elem[1], elem[2], elem[4], repo_model.MergeStyleSquash)
- hookTasks, err = webhook.HookTasks(1, 1)
+ hookTasks, err = webhook.HookTasks(db.DefaultContext, 1, 1)
assert.NoError(t, err)
assert.Len(t, hookTasks, hookTasksLenBefore+1)
})