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:
parent
f0663b3c13
commit
22f2853429
9 changed files with 21 additions and 20 deletions
|
@ -14,11 +14,11 @@ steps:
|
||||||
- name: gitea
|
- name: gitea
|
||||||
image: gitea/gitea:dev
|
image: gitea/gitea:dev
|
||||||
detach: true
|
detach: true
|
||||||
user: gitea
|
|
||||||
commands:
|
commands:
|
||||||
- mkdir -p /tmp/conf/
|
- mkdir -p /tmp/conf/
|
||||||
- mkdir -p /tmp/data/
|
- 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 "INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NTg4MzY4ODB9.LoKQyK5TN_0kMJFVHWUW0uDAyoGjDP6Mkup4ps2VJN4" >> /tmp/conf/app.ini
|
||||||
- echo "INSTALL_LOCK = true" >> /tmp/conf/app.ini
|
- echo "INSTALL_LOCK = true" >> /tmp/conf/app.ini
|
||||||
- echo "SECRET_KEY = 2crAW4UANgvLipDS6U5obRcFosjSJHQANll6MNfX7P0G3se3fKcCwwK3szPyGcbo" >> /tmp/conf/app.ini
|
- echo "SECRET_KEY = 2crAW4UANgvLipDS6U5obRcFosjSJHQANll6MNfX7P0G3se3fKcCwwK3szPyGcbo" >> /tmp/conf/app.ini
|
||||||
|
@ -37,7 +37,7 @@ steps:
|
||||||
pull: always
|
pull: always
|
||||||
image: golang:1.16
|
image: golang:1.16
|
||||||
environment:
|
environment:
|
||||||
GOPROXY: "https://goproxy.cn"
|
GOPROXY: "https://goproxy.io"
|
||||||
GO111MODULE: "on"
|
GO111MODULE: "on"
|
||||||
HTTP_PROXY: ""
|
HTTP_PROXY: ""
|
||||||
GITEA_SDK_TEST_URL: "http://gitea:3000"
|
GITEA_SDK_TEST_URL: "http://gitea:3000"
|
||||||
|
|
|
@ -45,7 +45,7 @@ func TestAdminCronTasks(t *testing.T) {
|
||||||
|
|
||||||
tasks, _, err := c.ListCronTasks(ListCronTaskOptions{})
|
tasks, _, err := c.ListCronTasks(ListCronTaskOptions{})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Len(t, tasks, 18)
|
assert.Len(t, tasks, 19)
|
||||||
_, err = c.RunCronTasks(tasks[0].Name)
|
_, err = c.RunCronTasks(tasks[0].Name)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ func TestNotifications(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
user2 := createTestUser(t, "notify2", c)
|
user2 := createTestUser(t, "notify2", c)
|
||||||
|
|
||||||
//create 2 repos
|
// create 2 repos
|
||||||
repoA, err := createTestRepo(t, "TestNotifications_A", c)
|
repoA, err := createTestRepo(t, "TestNotifications_A", c)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
@ -118,16 +118,16 @@ func TestNotifications(t *testing.T) {
|
||||||
_, _ = c.DeleteRepo("test01", "Reviews")
|
_, _ = c.DeleteRepo("test01", "Reviews")
|
||||||
nList, _, err = c.ListNotifications(ListNotificationOptions{Status: []NotifyStatus{NotifyStatusRead}})
|
nList, _, err = c.ListNotifications(ListNotificationOptions{Status: []NotifyStatus{NotifyStatusRead}})
|
||||||
assert.NoError(t, err)
|
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)
|
assert.NoError(t, err)
|
||||||
_, err = c.ReadNotification(nList[3].ID, NotifyStatusUnread)
|
_, err = c.ReadNotification(nList[1].ID, NotifyStatusUnread)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
nList, _, err = c.ListNotifications(ListNotificationOptions{Status: []NotifyStatus{NotifyStatusPinned, NotifyStatusUnread}})
|
nList, _, err = c.ListNotifications(ListNotificationOptions{Status: []NotifyStatus{NotifyStatusPinned, NotifyStatusUnread}})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
if assert.Len(t, nList, 2) {
|
if assert.Len(t, nList, 2) {
|
||||||
assert.EqualValues(t, NotifySubjectClosed, nList[0].Subject.State)
|
assert.EqualValues(t, NotifySubjectOpen, nList[0].Subject.State)
|
||||||
assert.EqualValues(t, NotifySubjectClosed, nList[1].Subject.State)
|
assert.EqualValues(t, NotifySubjectOpen, nList[1].Subject.State)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ func TestRelease(t *testing.T) {
|
||||||
IsPreRelease: &tr,
|
IsPreRelease: &tr,
|
||||||
})
|
})
|
||||||
assert.NoError(t, err)
|
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
|
// test fallback
|
||||||
r2, _, err = c.fallbackGetReleaseByTag(repo.Owner.UserName, repo.Name, r.TagName)
|
r2, _, err = c.fallbackGetReleaseByTag(repo.Owner.UserName, repo.Name, r.TagName)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
|
@ -41,8 +41,8 @@ func TestRepoCollaborator(t *testing.T) {
|
||||||
|
|
||||||
reviewers, _, err := c.GetReviewers(repo.Owner.UserName, repo.Name)
|
reviewers, _, err := c.GetReviewers(repo.Owner.UserName, repo.Name)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Len(t, reviewers, 2)
|
assert.Len(t, reviewers, 3)
|
||||||
assert.EqualValues(t, []string{"ping", "pong"}, userToStringSlice(reviewers))
|
assert.EqualValues(t, []string{"ping", "pong", "test01"}, userToStringSlice(reviewers))
|
||||||
|
|
||||||
assignees, _, err := c.GetAssignees(repo.Owner.UserName, repo.Name)
|
assignees, _, err := c.GetAssignees(repo.Owner.UserName, repo.Name)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
|
@ -21,18 +21,19 @@ func TestRepoTransfer(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
newRepo, _, err := c.TransferRepo(repo.Owner.UserName, repo.Name, TransferRepoOption{NewOwner: org.UserName})
|
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.NotNil(t, newRepo)
|
||||||
|
assert.EqualValues(t, "ToMove", newRepo.Name)
|
||||||
|
|
||||||
repo, err = createTestRepo(t, "ToMove", c)
|
repo, err = createTestRepo(t, "ToMove", c)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
_, _, err = c.TransferRepo(repo.Owner.UserName, repo.Name, TransferRepoOption{NewOwner: org.UserName})
|
_, _, 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)
|
_, err = c.DeleteRepo(repo.Owner.UserName, repo.Name)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
_, err = c.DeleteRepo(newRepo.Owner.UserName, newRepo.Name)
|
_, err = c.DeleteRepo(newRepo.Owner.UserName, newRepo.Name)
|
||||||
assert.NoError(t, err)
|
assert.Error(t, err)
|
||||||
_, err = c.DeleteOrg(org.UserName)
|
_, err = c.DeleteOrg(org.UserName)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ func TestGetGlobalSettings(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.EqualValues(t, &GlobalAttachmentSettings{
|
assert.EqualValues(t, &GlobalAttachmentSettings{
|
||||||
Enabled: true,
|
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,
|
MaxSize: 4,
|
||||||
MaxFiles: 5,
|
MaxFiles: 5,
|
||||||
}, attachSettings)
|
}, attachSettings)
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestUserSettings(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.NotNil(t, userConf)
|
assert.NotNil(t, userConf)
|
||||||
assert.EqualValues(t, UserSettings{
|
assert.EqualValues(t, UserSettings{
|
||||||
Theme: "gitea",
|
Theme: "auto",
|
||||||
HideEmail: false,
|
HideEmail: false,
|
||||||
HideActivity: false,
|
HideActivity: false,
|
||||||
}, *userConf)
|
}, *userConf)
|
||||||
|
@ -33,7 +33,7 @@ func TestUserSettings(t *testing.T) {
|
||||||
assert.NotNil(t, userConf)
|
assert.NotNil(t, userConf)
|
||||||
assert.EqualValues(t, UserSettings{
|
assert.EqualValues(t, UserSettings{
|
||||||
FullName: "Admin User on Test",
|
FullName: "Admin User on Test",
|
||||||
Theme: "gitea",
|
Theme: "auto",
|
||||||
Language: "de_de",
|
Language: "de_de",
|
||||||
HideEmail: true,
|
HideEmail: true,
|
||||||
HideActivity: false,
|
HideActivity: false,
|
||||||
|
|
|
@ -21,7 +21,7 @@ func TestMyUser(t *testing.T) {
|
||||||
assert.EqualValues(t, "test01", user.UserName)
|
assert.EqualValues(t, "test01", user.UserName)
|
||||||
assert.EqualValues(t, "test01@gitea.io", user.Email)
|
assert.EqualValues(t, "test01@gitea.io", user.Email)
|
||||||
assert.EqualValues(t, "", user.FullName)
|
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)
|
assert.True(t, user.IsAdmin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue