Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed May 7, 2020
1 parent 40daa23 commit 4c053c1
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions ntex/src/web/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,10 @@ mod tests {
let req = TestRequest::with_uri("/app/path1").to_request();
let resp = srv.call(req).await.unwrap();
assert_eq!(resp.status(), StatusCode::OK);

let req = TestRequest::with_uri("/app/path10").to_request();
let resp = srv.call(req).await.unwrap();
assert_eq!(resp.status(), StatusCode::NOT_FOUND);
}

#[ntex_rt::test]
Expand Down Expand Up @@ -737,9 +741,9 @@ mod tests {
)
.await;

// let req = TestRequest::with_uri("/app").to_request();
// let resp = srv.call(req).await.unwrap();
// assert_eq!(resp.status(), StatusCode::NOT_FOUND);
let req = TestRequest::with_uri("/app").to_request();
let resp = srv.call(req).await.unwrap();
assert_eq!(resp.status(), StatusCode::NOT_FOUND);

let req = TestRequest::with_uri("/app/").to_request();
let resp = srv.call(req).await.unwrap();
Expand Down Expand Up @@ -860,12 +864,9 @@ mod tests {
let resp = srv.call(req).await.unwrap();
assert_eq!(resp.status(), StatusCode::OK);

match resp.response().body() {
ResponseBody::Body(Body::Bytes(ref b)) => {
let bytes: Bytes = b.clone();
assert_eq!(bytes, Bytes::from_static(b"project: project1"));
}
_ => panic!(),
if let ResponseBody::Body(Body::Bytes(ref b)) = resp.response().body() {
let bytes: Bytes = b.clone();
assert_eq!(bytes, Bytes::from_static(b"project: project1"));
}

let req = TestRequest::with_uri("/aa-project1/path1").to_request();
Expand Down Expand Up @@ -964,12 +965,9 @@ mod tests {
let resp = srv.call(req).await.unwrap();
assert_eq!(resp.status(), StatusCode::CREATED);

match resp.response().body() {
ResponseBody::Body(Body::Bytes(ref b)) => {
let bytes: Bytes = b.clone();
assert_eq!(bytes, Bytes::from_static(b"project: project_1"));
}
_ => panic!(),
if let ResponseBody::Body(Body::Bytes(ref b)) = resp.response().body() {
let bytes: Bytes = b.clone();
assert_eq!(bytes, Bytes::from_static(b"project: project_1"));
}
}

Expand All @@ -992,12 +990,9 @@ mod tests {
let resp = srv.call(req).await.unwrap();
assert_eq!(resp.status(), StatusCode::CREATED);

match resp.response().body() {
ResponseBody::Body(Body::Bytes(ref b)) => {
let bytes: Bytes = b.clone();
assert_eq!(bytes, Bytes::from_static(b"project: test - 1"));
}
_ => panic!(),
if let ResponseBody::Body(Body::Bytes(ref b)) = resp.response().body() {
let bytes: Bytes = b.clone();
assert_eq!(bytes, Bytes::from_static(b"project: test - 1"));
}

let req = TestRequest::with_uri("/app/test/1/path2").to_request();
Expand Down

0 comments on commit 4c053c1

Please sign in to comment.