diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-04-14 21:58:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-14 21:58:21 +0800 |
commit | b8911fb45673fdc3fce587892c4d9215e7c15019 (patch) | |
tree | df72d047049f53cdbe9cb5d16a03b814f29e9ca6 /services | |
parent | 4dabc212c70d0cb0874d3af61d1ea24abd468f7e (diff) | |
download | gitea-b8911fb45673fdc3fce587892c4d9215e7c15019.tar.gz gitea-b8911fb45673fdc3fce587892c4d9215e7c15019.zip |
Use a struct as test options (#19393)
* Use a struct as test options
* Fix name
* Fix test
Diffstat (limited to 'services')
-rw-r--r-- | services/asymkey/main_test.go | 4 | ||||
-rw-r--r-- | services/attachment/attachment_test.go | 4 | ||||
-rw-r--r-- | services/gitdiff/main_test.go | 4 | ||||
-rw-r--r-- | services/issue/main_test.go | 4 | ||||
-rw-r--r-- | services/mailer/main_test.go | 4 | ||||
-rw-r--r-- | services/migrations/main_test.go | 4 | ||||
-rw-r--r-- | services/org/org_test.go | 4 | ||||
-rw-r--r-- | services/pull/main_test.go | 4 | ||||
-rw-r--r-- | services/release/release_test.go | 4 | ||||
-rw-r--r-- | services/repository/archiver/archiver_test.go | 4 | ||||
-rw-r--r-- | services/repository/files/content_test.go | 4 | ||||
-rw-r--r-- | services/repository/main_test.go | 4 | ||||
-rw-r--r-- | services/user/user_test.go | 4 | ||||
-rw-r--r-- | services/webhook/main_test.go | 4 | ||||
-rw-r--r-- | services/wiki/wiki_test.go | 4 |
15 files changed, 45 insertions, 15 deletions
diff --git a/services/asymkey/main_test.go b/services/asymkey/main_test.go index a891a10cf6..cb3d059456 100644 --- a/services/asymkey/main_test.go +++ b/services/asymkey/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } diff --git a/services/attachment/attachment_test.go b/services/attachment/attachment_test.go index 9ebd0d29ab..ffce5943e5 100644 --- a/services/attachment/attachment_test.go +++ b/services/attachment/attachment_test.go @@ -17,7 +17,9 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } func TestUploadAttachment(t *testing.T) { diff --git a/services/gitdiff/main_test.go b/services/gitdiff/main_test.go index 8c76e7e153..d4d9364ebf 100644 --- a/services/gitdiff/main_test.go +++ b/services/gitdiff/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } diff --git a/services/issue/main_test.go b/services/issue/main_test.go index cbcfd08a49..689ae744f6 100644 --- a/services/issue/main_test.go +++ b/services/issue/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } diff --git a/services/mailer/main_test.go b/services/mailer/main_test.go index ae3b2c12b4..0bd154113f 100644 --- a/services/mailer/main_test.go +++ b/services/mailer/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } diff --git a/services/migrations/main_test.go b/services/migrations/main_test.go index b040df83d1..ad9bc9c731 100644 --- a/services/migrations/main_test.go +++ b/services/migrations/main_test.go @@ -17,7 +17,9 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } func timePtr(t time.Time) *time.Time { diff --git a/services/org/org_test.go b/services/org/org_test.go index b30bfddbb4..7f90d85807 100644 --- a/services/org/org_test.go +++ b/services/org/org_test.go @@ -17,7 +17,9 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } func TestDeleteOrganization(t *testing.T) { diff --git a/services/pull/main_test.go b/services/pull/main_test.go index 6059a291ad..5471686e72 100644 --- a/services/pull/main_test.go +++ b/services/pull/main_test.go @@ -13,5 +13,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } diff --git a/services/release/release_test.go b/services/release/release_test.go index ec2282d7db..19d985491f 100644 --- a/services/release/release_test.go +++ b/services/release/release_test.go @@ -21,7 +21,9 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } func TestRelease_Create(t *testing.T) { diff --git a/services/repository/archiver/archiver_test.go b/services/repository/archiver/archiver_test.go index b7fb6cb0ca..24437ce76c 100644 --- a/services/repository/archiver/archiver_test.go +++ b/services/repository/archiver/archiver_test.go @@ -17,7 +17,9 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", "..", ".."), + }) } func TestArchive_Basic(t *testing.T) { diff --git a/services/repository/files/content_test.go b/services/repository/files/content_test.go index 84bb1c2e02..8a3e589bdf 100644 --- a/services/repository/files/content_test.go +++ b/services/repository/files/content_test.go @@ -16,7 +16,9 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", "..", ".."), + }) } func getExpectedReadmeContentsResponse() *api.ContentsResponse { diff --git a/services/repository/main_test.go b/services/repository/main_test.go index 262d339481..42134fa7ad 100644 --- a/services/repository/main_test.go +++ b/services/repository/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } diff --git a/services/user/user_test.go b/services/user/user_test.go index 7835530394..cfa02b0033 100644 --- a/services/user/user_test.go +++ b/services/user/user_test.go @@ -20,7 +20,9 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } func TestDeleteUser(t *testing.T) { diff --git a/services/webhook/main_test.go b/services/webhook/main_test.go index a87b74e89d..25b9df0af6 100644 --- a/services/webhook/main_test.go +++ b/services/webhook/main_test.go @@ -14,5 +14,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go index 17ec657cac..0c73074dbe 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -20,7 +20,9 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", ".."), + }) } func TestWikiNameToSubURL(t *testing.T) { |