Skip to content

Commit 845638b

Browse files
committed
tests: fix failing
1 parent 752bfe2 commit 845638b

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

graph/src/data/subgraph/status.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Support for the indexing status API
22
3-
use juniper::GraphQLObject;
4-
53
use super::schema::{SubgraphError, SubgraphHealth};
64
use crate::blockchain::BlockHash;
75
use crate::components::store::{BlockNumber, DeploymentId};

server/http/src/test_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pub fn assert_error_response(
5252
let json: serde_json::Value =
5353
serde_json::from_str(&body).expect("GraphQL response is not valid JSON");
5454

55+
println!("{:?}", json);
5556
json.as_object()
5657
.expect("GraphQL response must be an object")
5758
.get("errors")

server/http/tests/server.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ impl GraphQlRunner for TestGraphQlRunner {
8585

8686
#[cfg(test)]
8787
mod test {
88+
use http::header::CONTENT_TYPE;
89+
8890
use super::*;
8991

9092
lazy_static! {
@@ -114,7 +116,7 @@ mod test {
114116
// Send an empty JSON POST request
115117
let client = Client::new();
116118
let request =
117-
Request::post(format!("http://localhost:8007/subgraphs/id/{}", id))
119+
Request::post(format!("http://localhost:8007/subgraphs/id/{}", id)).header(CONTENT_TYPE, "text/plain")
118120
.body(Body::from("{}"))
119121
.unwrap();
120122

@@ -128,7 +130,7 @@ mod test {
128130
let message = errors[0]
129131
.as_str()
130132
.expect("Error message is not a string");
131-
assert_eq!(message, "GraphQL server error (client error): The \"query\" field is missing in request data");
133+
assert_eq!(message, "{\"error\":\"GraphQL server error (client error): The \\\"query\\\" field is missing in request data\"}");
132134
}).await.unwrap()
133135
})
134136
}
@@ -157,15 +159,15 @@ mod test {
157159
let client = Client::new();
158160
let request =
159161
Request::post(format!("http://localhost:8002/subgraphs/id/{}", id))
162+
.header(CONTENT_TYPE, "text/plain")
160163
.body(Body::from("{\"query\": \"<L<G<>M>\"}"))
161164
.unwrap();
162165

163166
// The response must be a query error
164167
client.request(request)
165168
})
166169
.map_ok(|response| {
167-
let errors =
168-
test_utils::assert_error_response(response, StatusCode::BAD_REQUEST, true);
170+
let errors = test_utils::assert_error_response(response, StatusCode::OK, true);
169171

170172
let message = errors[0]
171173
.as_object()

0 commit comments

Comments
 (0)