diff --git a/.travis.yml b/.travis.yml index 642cfb46c83910dbf0dc8584740e76059fbb38e4..39f12454cd6336b73fc06287384ae4545fb8787c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,19 @@ go: before_install: - go get github.com/mattn/goveralls +before_script: + - touch secret.ini + - echo "[mysql]" >> secret.ini + - echo "user=$MySQL_USER" >> secret.ini + - echo "password=$MySQL_PASSWORD" >> secret.ini + - echo "ip=$MySQL_IP" >> secret.ini + - echo "port=$MySQL_PORT" >> secret.ini + - echo "dbname=$MySQL_DBNAME" >> secret.ini + script: - ls && make build && ls - goveralls -service=travis-ci + deploy: provider: pages @@ -17,3 +27,6 @@ deploy: target_branch: master # Add this line - To push into GitHub master branch on: branch: master # Your GitHub repo default branch + +after_script: + rm -rf secret.ini \ No newline at end of file diff --git a/src/dao/friendship_test.go b/src/dao/friendship_test.go index ac48ec28f7d455c3d22a8b2c8e9f12f011e95def..8bf8aa7ed8e024d99413a29504a42d38124a91ae 100644 --- a/src/dao/friendship_test.go +++ b/src/dao/friendship_test.go @@ -2,16 +2,15 @@ package dao import "testing" -func TestAddFriendship(t *testing.T) { - // test FriendshipLink has ImgLink and Intro - err := AddFriendship(&FriendShipLink{ - SiteLink: "https://draveness.me/", - SiteName: "面向信仰编程", - ImgLink: "https://draveness.me/images/draven-logo.png", - Intro: "面向信仰编程", - }) - if err != nil { - t.Error(err) +func TestQueryAllFriendLink(t *testing.T) { + var fls []FriendShipLink + if err := QueryAllFriendLink(&fls); err != nil { + t.Error("Error!") + } + if len(fls) <= 0 { + t.Error("没拿到") + } + if fls[0].SiteName == "" { + t.Error("Nil") } - // test FriendshipLink without ImgLink and Intro }