Skip to content

Commit

Permalink
Move ResponseIncludesBlob to test_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed Sep 16, 2024
1 parent 35ea238 commit c9f0f93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
7 changes: 1 addition & 6 deletions crates/robonode-client/src/authenticate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod tests {
use wiremock::{matchers, Mock, MockServer, ResponseTemplate};

use super::*;
use crate::test_utils::mkerr;
use crate::test_utils::{mkerr, ResponseIncludesBlob};

#[test]
fn request_serialization() {
Expand Down Expand Up @@ -278,11 +278,6 @@ mod tests {

#[tokio::test]
async fn mock_error_response() {
enum ResponseIncludesBlob {
Yes,
No,
}

let cases = [
(
StatusCode::BAD_REQUEST,
Expand Down
7 changes: 1 addition & 6 deletions crates/robonode-client/src/enroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mod tests {
use wiremock::{matchers, Mock, MockServer, ResponseTemplate};

use super::*;
use crate::test_utils::mkerr;
use crate::test_utils::{mkerr, ResponseIncludesBlob};

#[test]
fn request_serialization() {
Expand Down Expand Up @@ -232,11 +232,6 @@ mod tests {

#[tokio::test]
async fn mock_error_response() {
enum ResponseIncludesBlob {
Yes,
No,
}

let cases = [
(
StatusCode::BAD_REQUEST,
Expand Down
5 changes: 5 additions & 0 deletions crates/robonode-client/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
pub enum ResponseIncludesBlob {
Yes,
No,
}

pub fn mkerr(error_code: &str, maybe_scan_result_blob: Option<&str>) -> serde_json::Value {
match maybe_scan_result_blob {
None => serde_json::json!({ "errorCode": error_code}),
Expand Down

0 comments on commit c9f0f93

Please sign in to comment.