1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-06-30 22:13:45 +02:00

Use Goblin Assert as intended (#501)

this allow for better debugging if an error occur
This commit is contained in:
6543
2021-11-04 14:42:25 +01:00
committed by GitHub
parent 58838f225c
commit aca5fddcf3
18 changed files with 192 additions and 192 deletions

View File

@ -68,7 +68,7 @@ func Test_github(t *testing.T) {
})
g.It("Should handle malformed url", func() {
_, err := New(Opts{URL: "%gh&%ij"})
g.Assert(err != nil).IsTrue()
g.Assert(err).IsNotNil()
})
})
@ -98,7 +98,7 @@ func Test_github(t *testing.T) {
g.Describe("Requesting a repository", func() {
g.It("Should return the repository details", func() {
repo, err := c.Repo(ctx, fakeUser, fakeRepo.Owner, fakeRepo.Name)
g.Assert(err == nil).IsTrue()
g.Assert(err).IsNil()
g.Assert(repo.Owner).Equal(fakeRepo.Owner)
g.Assert(repo.Name).Equal(fakeRepo.Name)
g.Assert(repo.FullName).Equal(fakeRepo.FullName)
@ -108,21 +108,21 @@ func Test_github(t *testing.T) {
})
g.It("Should handle a not found error", func() {
_, err := c.Repo(ctx, fakeUser, fakeRepoNotFound.Owner, fakeRepoNotFound.Name)
g.Assert(err != nil).IsTrue()
g.Assert(err).IsNotNil()
})
})
g.Describe("Requesting repository permissions", func() {
g.It("Should return the permission details", func() {
perm, err := c.Perm(ctx, fakeUser, fakeRepo.Owner, fakeRepo.Name)
g.Assert(err == nil).IsTrue()
g.Assert(err).IsNil()
g.Assert(perm.Admin).IsTrue()
g.Assert(perm.Push).IsTrue()
g.Assert(perm.Pull).IsTrue()
})
g.It("Should handle a not found error", func() {
_, err := c.Perm(ctx, fakeUser, fakeRepoNotFound.Owner, fakeRepoNotFound.Name)
g.Assert(err != nil).IsTrue()
g.Assert(err).IsNotNil()
})
})