@@ -111,6 +111,8 @@ mod tests {
111
111
StatusCode :: UNAUTHORIZED ,
112
112
"test deploy if API_KEY is missing"
113
113
) ;
114
+ // set the API_KEY to right
115
+ env:: set_var ( "API_KEY" , "right" ) ;
114
116
115
117
let req = test:: TestRequest :: get ( )
116
118
. uri ( "/deploy" )
@@ -122,7 +124,7 @@ mod tests {
122
124
StatusCode :: FORBIDDEN ,
123
125
"test deploy if API_KEY is wrong"
124
126
) ;
125
-
127
+
126
128
env:: set_var ( "API_KEY" , "right" ) ;
127
129
let req = test:: TestRequest :: get ( )
128
130
. uri ( "/deploy" )
@@ -139,7 +141,7 @@ mod tests {
139
141
body, "Missing url query parameter" ,
140
142
"test body if url is missing"
141
143
) ;
142
-
144
+ // test status if url is not end with .tar.gz
143
145
let req = test:: TestRequest :: get ( )
144
146
. uri ( "/deploy?url=https://example.com" )
145
147
. append_header ( ( "X-Api-Key" , "right" ) )
@@ -155,7 +157,7 @@ mod tests {
155
157
body, "currently only .tar.gz files are supported" ,
156
158
"test body if url is not end with .tar.gz"
157
159
) ;
158
-
160
+ // test status if url is end with .tar.gz;
159
161
let req = test:: TestRequest :: get ( )
160
162
. uri ( "/deploy?url=https://example.com/test.tar.gz" )
161
163
. append_header ( ( "X-Api-Key" , "right" ) )
@@ -167,9 +169,6 @@ mod tests {
167
169
"test status if url is end with .tar.gz"
168
170
) ;
169
171
let body = test:: read_body ( res) . await ;
170
- assert_eq ! (
171
- body, "start deploy https://example.com/test.tar.gz\r \n " ,
172
- "test body if url is end with .tar.gz"
173
- ) ;
172
+ assert ! ( body. starts_with( "start deploy https://example.com/test.tar.gz\r \n " . as_bytes( ) ) ) ;
174
173
}
175
174
}
0 commit comments