@@ -13,7 +13,6 @@ import (
13
13
"github.com/gaia-pipeline/gaia/store"
14
14
hclog "github.com/hashicorp/go-hclog"
15
15
"github.com/labstack/echo"
16
- "github.com/stretchr/testify/assert"
17
16
)
18
17
19
18
func TestPipelineGitLSRemote (t * testing.T ) {
@@ -33,7 +32,10 @@ func TestPipelineGitLSRemote(t *testing.T) {
33
32
}
34
33
35
34
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
+ }
37
39
38
40
e := echo .New ()
39
41
InitHandlers (e , dataStore , nil )
@@ -44,8 +46,11 @@ func TestPipelineGitLSRemote(t *testing.T) {
44
46
rec := httptest .NewRecorder ()
45
47
c := e .NewContext (req , rec )
46
48
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
+ }
49
54
})
50
55
51
56
t .Run ("fails with invalid access" , func (t * testing.T ) {
@@ -61,8 +66,11 @@ func TestPipelineGitLSRemote(t *testing.T) {
61
66
rec := httptest .NewRecorder ()
62
67
c := e .NewContext (req , rec )
63
68
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
+ }
66
74
})
67
75
68
76
t .Run ("otherwise succeed" , func (t * testing.T ) {
@@ -78,7 +86,10 @@ func TestPipelineGitLSRemote(t *testing.T) {
78
86
rec := httptest .NewRecorder ()
79
87
c := e .NewContext (req , rec )
80
88
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
+ }
83
94
})
84
95
}
0 commit comments