Use goproxy.io instead of goproxy.cn (#574)

Fix CI, Fix #572

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/574
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Lunny Xiao 2022-03-29 07:09:57 +08:00 committed by Andrew Thornton
parent f0663b3c13
commit 22f2853429
9 changed files with 21 additions and 20 deletions

View file

@ -14,11 +14,11 @@ steps:
- name: gitea
image: gitea/gitea:dev
detach: true
user: gitea
commands:
- mkdir -p /tmp/conf/
- mkdir -p /tmp/data/
- echo "[security]" > /tmp/conf/app.ini
- echo "I_AM_BEING_UNSAFE_RUNNING_AS_ROOT = true" > /tmp/conf/app.ini
- echo "[security]" >> /tmp/conf/app.ini
- echo "INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NTg4MzY4ODB9.LoKQyK5TN_0kMJFVHWUW0uDAyoGjDP6Mkup4ps2VJN4" >> /tmp/conf/app.ini
- echo "INSTALL_LOCK = true" >> /tmp/conf/app.ini
- echo "SECRET_KEY = 2crAW4UANgvLipDS6U5obRcFosjSJHQANll6MNfX7P0G3se3fKcCwwK3szPyGcbo" >> /tmp/conf/app.ini
@ -37,7 +37,7 @@ steps:
pull: always
image: golang:1.16
environment:
GOPROXY: "https://goproxy.cn"
GOPROXY: "https://goproxy.io"
GO111MODULE: "on"
HTTP_PROXY: ""
GITEA_SDK_TEST_URL: "http://gitea:3000"

View file

@ -45,7 +45,7 @@ func TestAdminCronTasks(t *testing.T) {
tasks, _, err := c.ListCronTasks(ListCronTaskOptions{})
assert.NoError(t, err)
assert.Len(t, tasks, 18)
assert.Len(t, tasks, 19)
_, err = c.RunCronTasks(tasks[0].Name)
assert.NoError(t, err)
}

View file

@ -118,16 +118,16 @@ func TestNotifications(t *testing.T) {
_, _ = c.DeleteRepo("test01", "Reviews")
nList, _, err = c.ListNotifications(ListNotificationOptions{Status: []NotifyStatus{NotifyStatusRead}})
assert.NoError(t, err)
assert.Len(t, nList, 4)
assert.Len(t, nList, 2)
_, err = c.ReadNotification(nList[2].ID, NotifyStatusPinned)
_, err = c.ReadNotification(nList[0].ID, NotifyStatusPinned)
assert.NoError(t, err)
_, err = c.ReadNotification(nList[3].ID, NotifyStatusUnread)
_, err = c.ReadNotification(nList[1].ID, NotifyStatusUnread)
assert.NoError(t, err)
nList, _, err = c.ListNotifications(ListNotificationOptions{Status: []NotifyStatus{NotifyStatusPinned, NotifyStatusUnread}})
assert.NoError(t, err)
if assert.Len(t, nList, 2) {
assert.EqualValues(t, NotifySubjectClosed, nList[0].Subject.State)
assert.EqualValues(t, NotifySubjectClosed, nList[1].Subject.State)
assert.EqualValues(t, NotifySubjectOpen, nList[0].Subject.State)
assert.EqualValues(t, NotifySubjectOpen, nList[1].Subject.State)
}
}

View file

@ -57,7 +57,7 @@ func TestRelease(t *testing.T) {
IsPreRelease: &tr,
})
assert.NoError(t, err)
assert.Len(t, rl, 0) // created release is a pre-release
assert.Len(t, rl, 1) // created release is a pre-release
// test fallback
r2, _, err = c.fallbackGetReleaseByTag(repo.Owner.UserName, repo.Name, r.TagName)
assert.NoError(t, err)

View file

@ -41,8 +41,8 @@ func TestRepoCollaborator(t *testing.T) {
reviewers, _, err := c.GetReviewers(repo.Owner.UserName, repo.Name)
assert.NoError(t, err)
assert.Len(t, reviewers, 2)
assert.EqualValues(t, []string{"ping", "pong"}, userToStringSlice(reviewers))
assert.Len(t, reviewers, 3)
assert.EqualValues(t, []string{"ping", "pong", "test01"}, userToStringSlice(reviewers))
assignees, _, err := c.GetAssignees(repo.Owner.UserName, repo.Name)
assert.NoError(t, err)

View file

@ -21,18 +21,19 @@ func TestRepoTransfer(t *testing.T) {
assert.NoError(t, err)
newRepo, _, err := c.TransferRepo(repo.Owner.UserName, repo.Name, TransferRepoOption{NewOwner: org.UserName})
assert.NoError(t, err)
assert.NoError(t, err) // admin transfer repository will execute immediately but not set as pendding.
assert.NotNil(t, newRepo)
assert.EqualValues(t, "ToMove", newRepo.Name)
repo, err = createTestRepo(t, "ToMove", c)
assert.NoError(t, err)
_, _, err = c.TransferRepo(repo.Owner.UserName, repo.Name, TransferRepoOption{NewOwner: org.UserName})
assert.Error(t, err)
assert.Error(t, err, err.Error()) // org.UserName/repo.Name has exist
_, err = c.DeleteRepo(repo.Owner.UserName, repo.Name)
assert.NoError(t, err)
_, err = c.DeleteRepo(newRepo.Owner.UserName, newRepo.Name)
assert.NoError(t, err)
assert.Error(t, err)
_, err = c.DeleteOrg(org.UserName)
assert.NoError(t, err)
}

View file

@ -41,7 +41,7 @@ func TestGetGlobalSettings(t *testing.T) {
assert.NoError(t, err)
assert.EqualValues(t, &GlobalAttachmentSettings{
Enabled: true,
AllowedTypes: ".docx,.gif,.gz,.jpeg,.jpg,.log,.pdf,.png,.pptx,.txt,.xlsx,.zip",
AllowedTypes: ".docx,.gif,.gz,.jpeg,.jpg,.mp4,.log,.pdf,.png,.pptx,.txt,.xlsx,.zip",
MaxSize: 4,
MaxFiles: 5,
}, attachSettings)

View file

@ -19,7 +19,7 @@ func TestUserSettings(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, userConf)
assert.EqualValues(t, UserSettings{
Theme: "gitea",
Theme: "auto",
HideEmail: false,
HideActivity: false,
}, *userConf)
@ -33,7 +33,7 @@ func TestUserSettings(t *testing.T) {
assert.NotNil(t, userConf)
assert.EqualValues(t, UserSettings{
FullName: "Admin User on Test",
Theme: "gitea",
Theme: "auto",
Language: "de_de",
HideEmail: true,
HideActivity: false,

View file

@ -21,7 +21,7 @@ func TestMyUser(t *testing.T) {
assert.EqualValues(t, "test01", user.UserName)
assert.EqualValues(t, "test01@gitea.io", user.Email)
assert.EqualValues(t, "", user.FullName)
assert.EqualValues(t, getGiteaURL()+"/user/avatar/test01/-1", user.AvatarURL)
assert.EqualValues(t, "https://secure.gravatar.com/avatar/d794373e882a68fb173cef817fb6180a?d=identicon", user.AvatarURL)
assert.True(t, user.IsAdmin)
}