diff --git a/tests/integration/_cases/monitors/monitors-run.trycmd b/tests/integration/_cases/monitors/not_windows/monitors-run.trycmd similarity index 100% rename from tests/integration/_cases/monitors/monitors-run.trycmd rename to tests/integration/_cases/monitors/not_windows/monitors-run.trycmd diff --git a/tests/integration/_cases/monitors/monitors-run-server-error-win.trycmd b/tests/integration/_cases/monitors/server_error/monitors-run-server-error-win.trycmd similarity index 100% rename from tests/integration/_cases/monitors/monitors-run-server-error-win.trycmd rename to tests/integration/_cases/monitors/server_error/monitors-run-server-error-win.trycmd diff --git a/tests/integration/_cases/monitors/monitors-run-server-error.trycmd b/tests/integration/_cases/monitors/server_error/monitors-run-server-error.trycmd similarity index 100% rename from tests/integration/_cases/monitors/monitors-run-server-error.trycmd rename to tests/integration/_cases/monitors/server_error/monitors-run-server-error.trycmd diff --git a/tests/integration/_cases/monitors/monitors-run-win.trycmd b/tests/integration/_cases/monitors/windows/monitors-run-win.trycmd similarity index 100% rename from tests/integration/_cases/monitors/monitors-run-win.trycmd rename to tests/integration/_cases/monitors/windows/monitors-run-win.trycmd diff --git a/tests/integration/monitors.rs b/tests/integration/monitors.rs new file mode 100644 index 0000000000..6fc8129da8 --- /dev/null +++ b/tests/integration/monitors.rs @@ -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"); +} diff --git a/tests/integration/monitors/list.rs b/tests/integration/monitors/list.rs deleted file mode 100644 index 4399eb6923..0000000000 --- a/tests/integration/monitors/list.rs +++ /dev/null @@ -1,15 +0,0 @@ -use crate::integration::{mock_endpoint, register_test, EndpointOptions}; - -#[test] -fn command_monitors_list() { - let _server = mock_endpoint( - EndpointOptions::new("GET", "/api/0/organizations/wat-org/monitors/?cursor=", 200) - .with_response_file("monitors/get-monitors.json"), - ); - register_test("monitors/monitors-list.trycmd"); -} - -#[test] -fn command_monitors_list_help() { - register_test("monitors/monitors-list-help.trycmd"); -} diff --git a/tests/integration/monitors/mod.rs b/tests/integration/monitors/mod.rs deleted file mode 100644 index c13e754e7e..0000000000 --- a/tests/integration/monitors/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -use crate::integration::register_test; - -mod list; -mod run; - -#[test] -fn command_monitors_help() { - register_test("monitors/monitors-help.trycmd"); -} - -#[test] -fn command_monitors_no_subcommand() { - register_test("monitors/monitors-no-subcommand.trycmd"); -} diff --git a/tests/integration/monitors/run.rs b/tests/integration/monitors/run.rs deleted file mode 100644 index 64bffcabc8..0000000000 --- a/tests/integration/monitors/run.rs +++ /dev/null @@ -1,50 +0,0 @@ -use crate::integration::{self, EndpointOptions}; - -#[test] -fn command_monitors_run() { - let _server = - integration::mock_endpoint(EndpointOptions::new("POST", "/api/1337/envelope/", 200)); - if cfg!(windows) { - integration::register_test("monitors/monitors-run-win.trycmd"); - } else { - integration::register_test("monitors/monitors-run.trycmd"); - } -} - -#[test] -fn command_monitors_run_server_error() { - let _server = - integration::mock_endpoint(EndpointOptions::new("POST", "/api/1337/envelope/", 500)); - - #[cfg(not(windows))] - integration::register_test("monitors/monitors-run-server-error.trycmd"); - - #[cfg(windows)] - integration::register_test("monitors/monitors-run-server-error-win.trycmd"); -} - -#[test] -fn command_monitors_run_osenv() { - let _server = - integration::mock_endpoint(EndpointOptions::new("POST", "/api/1337/envelope/", 200)); - integration::register_test("monitors/monitors-run-osenv.trycmd"); -} - -#[test] -fn command_monitors_run_environment() { - let _server = - integration::mock_endpoint(EndpointOptions::new("POST", "/api/1337/envelope/", 200)); - integration::register_test("monitors/monitors-run-environment.trycmd"); -} - -#[test] -fn command_monitors_run_environment_long() { - let _server = - integration::mock_endpoint(EndpointOptions::new("POST", "/api/1337/envelope/", 200)); - integration::register_test("monitors/monitors-run-environment-long.trycmd"); -} - -#[test] -fn command_monitors_run_help() { - integration::register_test("monitors/monitors-run-help.trycmd"); -}