Skip to content

Commit

Permalink
test(monitors): Batch monitors tests
Browse files Browse the repository at this point in the history
  • Loading branch information
szokeasaurusrex committed Nov 7, 2024
1 parent 00a5f0a commit 1bfc41f
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 80 deletions.
34 changes: 34 additions & 0 deletions tests/integration/monitors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
use crate::integration::{mock_endpoint, register_test, EndpointOptions};

#[test]
fn command_monitors() {
let _list_endpoint = mock_endpoint(
EndpointOptions::new("GET", "/api/0/organizations/wat-org/monitors/?cursor=", 200)
.with_response_file("monitors/get-monitors.json"),
);
let _envelope_endpoint =
mock_endpoint(EndpointOptions::new("POST", "/api/1337/envelope/", 200));
let _token_endpoint = mock_endpoint(
EndpointOptions::new("POST", "/api/0/monitors/foo-monitor/checkins/", 200)
.with_response_file("monitors/post-monitors.json"),
);

let cases = register_test("monitors/*.trycmd");

#[cfg(not(windows))]
cases.case("tests/integration/_cases/monitors/not_windows/*.trycmd");

#[cfg(windows)]
cases.case("tests/integration/_cases/monitors/windows/*.trycmd");
}

#[test]
fn command_monitors_run_server_error() {
let _server = mock_endpoint(EndpointOptions::new("POST", "/api/1337/envelope/", 500));

#[cfg(not(windows))]
register_test("monitors/server_error/monitors-run-server-error.trycmd");

#[cfg(windows)]
register_test("monitors/server_error/monitors-run-server-error-win.trycmd");
}
15 changes: 0 additions & 15 deletions tests/integration/monitors/list.rs

This file was deleted.

14 changes: 0 additions & 14 deletions tests/integration/monitors/mod.rs

This file was deleted.

50 changes: 0 additions & 50 deletions tests/integration/monitors/run.rs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/integration/organizations/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn command_organizations_list() {
EndpointOptions::new("GET", "/api/0/users/me/regions/", 200)
.with_response_body(region_response),
);
register_test("organizations/organizations-list.trycmd");
register_test("organizations/*.trycmd");
}

#[test]
Expand Down

0 comments on commit 1bfc41f

Please sign in to comment.