Skip to content

Commit

Permalink
chore(test): Move integration test for tonic-web to tests directory (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored Sep 20, 2024
1 parent ffd7794 commit 99b663e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ members = [
"tests/stream_conflict",
"tests/root-crate-path",
"tests/compression",
"tonic-web/tests/integration",
"tests/web",
"tests/service_named_result",
"tests/use_arc_self",
"tests/default_stubs",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Juan Alvarez <[email protected]>"]
edition = "2021"
name = "integration"
name = "test_web"
publish = false
version = "0.1.0"
license = "MIT"
Expand All @@ -16,10 +16,10 @@ hyper-util = "0.1"
prost = "0.13"
tokio = { version = "1", features = ["macros", "rt", "net"] }
tokio-stream = { version = "0.1", features = ["net"] }
tonic = { path = "../../../tonic" }
tonic = { path = "../../tonic" }

[dev-dependencies]
tonic-web = { path = "../../../tonic-web" }
tonic-web = { path = "../../tonic-web" }

[build-dependencies]
tonic-build = { path = "../../../tonic-build" }
tonic-build = { path = "../../tonic-build" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use tokio_stream::{self as stream, StreamExt};
use tonic::transport::{Channel, Error, Server};
use tonic::{Response, Streaming};

use integration::pb::{test_client::TestClient, test_server::TestServer, Input};
use integration::Svc;
use test_web::pb::{test_client::TestClient, test_server::TestServer, Input};
use test_web::Svc;
use tonic_web::GrpcWebLayer;

#[tokio::test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use tokio_stream::wrappers::TcpListenerStream;
use tonic::body::BoxBody;
use tonic::transport::Server;

use integration::pb::{test_server::TestServer, Input, Output};
use integration::Svc;
use test_web::pb::{test_server::TestServer, Input, Output};
use test_web::Svc;
use tonic::Status;
use tonic_web::GrpcWebLayer;

Expand Down Expand Up @@ -117,7 +117,7 @@ fn build_request(base_uri: String, content_type: &str, accept: &str) -> Request<

let bytes = match content_type {
"grpc-web" => encode_body(),
"grpc-web-text" => integration::util::base64::STANDARD
"grpc-web-text" => test_web::util::base64::STANDARD
.encode(encode_body())
.into(),
_ => panic!("invalid content type {}", content_type),
Expand All @@ -139,7 +139,7 @@ async fn decode_body(body: Incoming, content_type: &str) -> (Output, Bytes) {
let mut body = body.collect().await.unwrap().to_bytes();

if content_type == "application/grpc-web-text+proto" {
body = integration::util::base64::STANDARD
body = test_web::util::base64::STANDARD
.decode(body)
.unwrap()
.into()
Expand Down

0 comments on commit 99b663e

Please sign in to comment.