@@ -13,6 +13,7 @@ import (
13
13
14
14
"github.com/aws/aws-lambda-go/events"
15
15
"github.com/stretchr/testify/assert"
16
+ "github.com/stretchr/testify/require"
16
17
"github.com/traefik/traefik/v2/pkg/config/dynamic"
17
18
"github.com/traefik/traefik/v2/pkg/tracing"
18
19
)
@@ -85,7 +86,7 @@ func Test_AWSLambdaMiddleware_Invoke(t *testing.T) {
85
86
rBody , _ := io .ReadAll (resp .Body )
86
87
87
88
assert .Equal (t , []byte ("response_body" ), rBody )
88
- assert .Equal (t , resp . StatusCode , http . StatusTeapot )
89
+ assert .Equal (t , http . StatusTeapot , resp . StatusCode )
89
90
}
90
91
91
92
// Test_AWSLambdaMiddleware_GetTracingInformation tests that the
@@ -107,12 +108,12 @@ func Test_AWSLambdaMiddleware_GetTracingInformation(t *testing.T) {
107
108
// Test_AWSLambdaMiddleware_bodyToBase64_empty
108
109
func Test_AWSLambdaMiddleware_bodyToBase64_empty (t * testing.T ) {
109
110
req , err := http .NewRequest (http .MethodGet , "/" , nil )
110
- assert .NoError (t , err )
111
+ require .NoError (t , err )
111
112
isEncoded , body , err := bodyToBase64 (req )
112
113
113
- assert .Equal (t , isEncoded , false )
114
- assert .Equal (t , body , "" )
115
- assert . Nil (t , err )
114
+ assert .False (t , isEncoded )
115
+ assert .Equal (t , "" , body )
116
+ require . NoError (t , err )
116
117
}
117
118
118
119
// Test_AWSLambdaMiddleware_bodyToBase64_withcontent
@@ -121,10 +122,10 @@ func Test_AWSLambdaMiddleware_bodyToBase64_withcontent(t *testing.T) {
121
122
reqBody := `{"test": "encoded"}`
122
123
123
124
req , err := http .NewRequest (http .MethodGet , "/" , strings .NewReader (reqBody ))
124
- assert . Nil (t , err )
125
+ require . NoError (t , err )
125
126
isEncoded , body , err := bodyToBase64 (req )
126
127
127
- assert .Equal (t , isEncoded , true )
128
- assert .Equal (t , body , expected )
129
- assert . Nil (t , err )
128
+ assert .True (t , isEncoded )
129
+ assert .Equal (t , expected , body )
130
+ require . NoError (t , err )
130
131
}
0 commit comments