Skip to content

Commit 81a34b5

Browse files
author
Alireza Bashiri
committed
Don't use testify/assert
1 parent cf1d1a0 commit 81a34b5

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

handlers/pipeline_test.go

+19-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/gaia-pipeline/gaia/store"
1414
hclog "github.com/hashicorp/go-hclog"
1515
"github.com/labstack/echo"
16-
"github.com/stretchr/testify/assert"
1716
)
1817

1918
func TestPipelineGitLSRemote(t *testing.T) {
@@ -33,7 +32,10 @@ func TestPipelineGitLSRemote(t *testing.T) {
3332
}
3433

3534
dataStore := store.NewStore()
36-
assert.NoError(t, dataStore.Init())
35+
err = dataStore.Init()
36+
if err != nil {
37+
t.Fatalf("cannot initialize store: %v", err.Error())
38+
}
3739

3840
e := echo.New()
3941
InitHandlers(e, dataStore, nil)
@@ -44,8 +46,11 @@ func TestPipelineGitLSRemote(t *testing.T) {
4446
rec := httptest.NewRecorder()
4547
c := e.NewContext(req, rec)
4648

47-
assert.NoError(t, PipelineGitLSRemote(c))
48-
assert.Equal(t, http.StatusBadRequest, rec.Code)
49+
PipelineGitLSRemote(c)
50+
51+
if rec.Code != http.StatusBadRequest {
52+
t.Fatalf("expected response code %v got %v", http.StatusOK, rec.Code)
53+
}
4954
})
5055

5156
t.Run("fails with invalid access", func(t *testing.T) {
@@ -61,8 +66,11 @@ func TestPipelineGitLSRemote(t *testing.T) {
6166
rec := httptest.NewRecorder()
6267
c := e.NewContext(req, rec)
6368

64-
assert.NoError(t, PipelineGitLSRemote(c))
65-
assert.Equal(t, http.StatusForbidden, rec.Code)
69+
PipelineGitLSRemote(c)
70+
71+
if rec.Code != http.StatusForbidden {
72+
t.Fatalf("expected response code %v got %v", http.StatusOK, rec.Code)
73+
}
6674
})
6775

6876
t.Run("otherwise succeed", func(t *testing.T) {
@@ -78,7 +86,10 @@ func TestPipelineGitLSRemote(t *testing.T) {
7886
rec := httptest.NewRecorder()
7987
c := e.NewContext(req, rec)
8088

81-
assert.NoError(t, PipelineGitLSRemote(c))
82-
assert.Equal(t, http.StatusOK, rec.Code)
89+
PipelineGitLSRemote(c)
90+
91+
if rec.Code != http.StatusOK {
92+
t.Fatalf("expected response code %v got %v", http.StatusOK, rec.Code)
93+
}
8394
})
8495
}

0 commit comments

Comments
 (0)