CI: fix test task #295

Merged
6543 merged 4 commits from 6543/go-sdk:fix-ci into master 2020-03-30 18:58:02 +00:00
2 changed files with 13 additions and 4 deletions

View File

@ -34,9 +34,10 @@ steps:
- name: testing
pull: always
image: golang:1.13
image: golang:1.14
environment:
GOPROXY: https://goproxy.cn,direct
GOPROXY: "https://goproxy.cn"
GO111MODULE: "on"
HTTP_PROXY: ""
GITEA_SDK_TEST_URL: "http://gitea:3000"
GITEA_SDK_TEST_USERNAME: "test01"

View File

@ -8,6 +8,7 @@ import (
"fmt"
"log"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
@ -43,6 +44,7 @@ func TestNotifications(t *testing.T) {
assert.NoError(t, err)
issue, err := c.CreateIssue(repoB.Owner.UserName, repoB.Name, CreateIssueOption{Title: "B Issue", Closed: false})
assert.NoError(t, err)
time.Sleep(time.Second * 1)
// CheckNotifications of user2
c.sudo = user2.UserName
@ -93,10 +95,16 @@ func TestNotifications(t *testing.T) {
c.sudo = ""
_, err = c.EditIssue(repoB.Owner.UserName, repoB.Name, issue.Index, EditIssueOption{State: &iState})
assert.NoError(t, err)
time.Sleep(time.Second * 1)
c.sudo = user2.UserName
nList, err = c.ListNotifications(ListNotificationOptions{})
assert.NoError(t, err)
assert.Len(t, nList, 1)
err = c.ReadNotification(nList[0].ID)
count, err = c.CheckNotifications()
assert.NoError(t, err)
assert.EqualValues(t, 1, count)
assert.Len(t, nList, 1)
if len(nList) > 0 {
assert.NoError(t, c.ReadNotification(nList[0].ID))
}
}