Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove common_tests dep from common #1537

Merged
merged 1 commit into from Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions common-tests/Cargo.toml
Expand Up @@ -20,5 +20,3 @@ tokio-stream = { workspace = true }
tonic = { workspace = true }
tower = { workspace = true }
uuid = { workspace = true }
wiremock = { workspace = true }
http = "1"
1 change: 0 additions & 1 deletion common-tests/src/lib.rs
@@ -1,6 +1,5 @@
pub mod builder;
pub mod cargo_shuttle;
pub mod gateway;
pub mod logger;
pub mod postgres;
pub mod resource_recorder;
Expand Down
2 changes: 1 addition & 1 deletion common/Cargo.toml
Expand Up @@ -108,9 +108,9 @@ base64 = { workspace = true }
hyper = { workspace = true }
proptest = "1.1.0"
ring = { workspace = true }
shuttle-common-tests = { workspace = true }
test-context = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tower = { workspace = true, features = ["util"] }
tracing-fluent-assertions = "0.3.0"
tracing-subscriber = { workspace = true }
wiremock = { workspace = true }
2 changes: 1 addition & 1 deletion common/src/backends/client/gateway.rs
Expand Up @@ -75,10 +75,10 @@ impl ProjectsDal for GatewayClient {
#[cfg(test)]
mod tests {
use async_trait::async_trait;
use shuttle_common_tests::gateway::mocked_gateway_server;
use test_context::{test_context, AsyncTestContext};

use crate::models::project::{Response, State};
use crate::test_utils::mocked_gateway_server;

use super::{GatewayClient, ProjectsDal};

Expand Down
2 changes: 1 addition & 1 deletion common/src/backends/client/mod.rs
Expand Up @@ -94,9 +94,9 @@ impl ServicesApiClient {
mod tests {
use headers::{authorization::Bearer, Authorization};
use http::{Method, StatusCode};
use shuttle_common_tests::gateway::mocked_gateway_server;

use crate::models;
use crate::test_utils::mocked_gateway_server;

use super::{Error, ServicesApiClient};

Expand Down
3 changes: 3 additions & 0 deletions common/src/lib.rs
Expand Up @@ -26,6 +26,9 @@ pub mod tracing;
#[cfg(feature = "wasm")]
pub mod wasm;

#[cfg(test)]
mod test_utils;

use std::fmt::Debug;

use anyhow::bail;
Expand Down
6 changes: 3 additions & 3 deletions common-tests/src/gateway.rs → common/src/test_utils.rs
@@ -1,6 +1,6 @@
use http::Method;
use serde::Serialize;
use wiremock::{
http,
matchers::{method, path},
Mock, MockServer, Request, ResponseTemplate,
};
Expand Down Expand Up @@ -32,10 +32,10 @@ pub async fn mocked_gateway_server() -> MockServer {
},
];

Mock::given(method(Method::GET))
Mock::given(method(http::Method::GET))
.and(path("/projects"))
.respond_with(move |req: &Request| {
let Some(bearer) = req.headers.get(&http::header::AUTHORIZATION) else {
let Some(bearer) = req.headers.get("AUTHORIZATION") else {
return ResponseTemplate::new(401);
};

Expand Down