From c25101c6b59b795efdaa9077dc0cb7751d11c6f9 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Thu, 14 Dec 2023 03:20:26 +0800 Subject: [PATCH] Move test generated clients into a buildable crate --- .gitignore | 2 + progenitor-impl/tests/output/Cargo.toml | 37 +++++++++++++++++++ .../buildomat_builder.rs} | 0 .../buildomat_builder_tagged.rs} | 0 .../buildomat_cli.rs} | 2 +- .../buildomat_httpmock.rs} | 2 +- .../buildomat_positional.rs} | 0 .../keeper_builder.rs} | 0 .../keeper_builder_tagged.rs} | 0 .../{keeper-cli.out => src/keeper_cli.rs} | 2 +- .../keeper_httpmock.rs} | 2 +- .../keeper_positional.rs} | 0 progenitor-impl/tests/output/src/lib.rs | 34 +++++++++++++++++ .../nexus_builder.rs} | 0 .../nexus_builder_tagged.rs} | 0 .../{nexus-cli.out => src/nexus_cli.rs} | 2 +- .../nexus_httpmock.rs} | 2 +- .../nexus_positional.rs} | 0 .../param_collision_builder.rs} | 0 .../param_collision_builder_tagged.rs} | 0 .../param_collision_cli.rs} | 2 +- .../param_collision_httpmock.rs} | 2 +- .../param_collision_positional.rs} | 0 .../param_overrides_builder.rs} | 0 .../param_overrides_builder_tagged.rs} | 0 .../param_overrides_cli.rs} | 2 +- .../param_overrides_httpmock.rs} | 2 +- .../param_overrides_positional.rs} | 0 .../propolis_server_builder.rs} | 0 .../propolis_server_builder_tagged.rs} | 0 .../propolis_server_cli.rs} | 2 +- .../propolis_server_httpmock.rs} | 2 +- .../propolis_server_positional.rs} | 0 .../test_default_params_builder.rs} | 0 .../test_default_params_positional.rs} | 0 .../test_freeform_response.rs} | 0 .../test_renamed_parameters.rs} | 0 progenitor-impl/tests/test_output.rs | 21 +++++++---- progenitor-impl/tests/test_specific.rs | 8 ++-- 39 files changed, 102 insertions(+), 24 deletions(-) create mode 100644 progenitor-impl/tests/output/Cargo.toml rename progenitor-impl/tests/output/{buildomat-builder.out => src/buildomat_builder.rs} (100%) rename progenitor-impl/tests/output/{buildomat-builder-tagged.out => src/buildomat_builder_tagged.rs} (100%) rename progenitor-impl/tests/output/{buildomat-cli.out => src/buildomat_cli.rs} (99%) rename progenitor-impl/tests/output/{buildomat-httpmock.out => src/buildomat_httpmock.rs} (99%) rename progenitor-impl/tests/output/{buildomat-positional.out => src/buildomat_positional.rs} (100%) rename progenitor-impl/tests/output/{keeper-builder.out => src/keeper_builder.rs} (100%) rename progenitor-impl/tests/output/{keeper-builder-tagged.out => src/keeper_builder_tagged.rs} (100%) rename progenitor-impl/tests/output/{keeper-cli.out => src/keeper_cli.rs} (99%) rename progenitor-impl/tests/output/{keeper-httpmock.out => src/keeper_httpmock.rs} (99%) rename progenitor-impl/tests/output/{keeper-positional.out => src/keeper_positional.rs} (100%) create mode 100644 progenitor-impl/tests/output/src/lib.rs rename progenitor-impl/tests/output/{nexus-builder.out => src/nexus_builder.rs} (100%) rename progenitor-impl/tests/output/{nexus-builder-tagged.out => src/nexus_builder_tagged.rs} (100%) rename progenitor-impl/tests/output/{nexus-cli.out => src/nexus_cli.rs} (99%) rename progenitor-impl/tests/output/{nexus-httpmock.out => src/nexus_httpmock.rs} (99%) rename progenitor-impl/tests/output/{nexus-positional.out => src/nexus_positional.rs} (100%) rename progenitor-impl/tests/output/{param-collision-builder.out => src/param_collision_builder.rs} (100%) rename progenitor-impl/tests/output/{param-collision-builder-tagged.out => src/param_collision_builder_tagged.rs} (100%) rename progenitor-impl/tests/output/{param-collision-cli.out => src/param_collision_cli.rs} (99%) rename progenitor-impl/tests/output/{param-collision-httpmock.out => src/param_collision_httpmock.rs} (98%) rename progenitor-impl/tests/output/{param-collision-positional.out => src/param_collision_positional.rs} (100%) rename progenitor-impl/tests/output/{param-overrides-builder.out => src/param_overrides_builder.rs} (100%) rename progenitor-impl/tests/output/{param-overrides-builder-tagged.out => src/param_overrides_builder_tagged.rs} (100%) rename progenitor-impl/tests/output/{param-overrides-cli.out => src/param_overrides_cli.rs} (98%) rename progenitor-impl/tests/output/{param-overrides-httpmock.out => src/param_overrides_httpmock.rs} (98%) rename progenitor-impl/tests/output/{param-overrides-positional.out => src/param_overrides_positional.rs} (100%) rename progenitor-impl/tests/output/{propolis-server-builder.out => src/propolis_server_builder.rs} (100%) rename progenitor-impl/tests/output/{propolis-server-builder-tagged.out => src/propolis_server_builder_tagged.rs} (100%) rename progenitor-impl/tests/output/{propolis-server-cli.out => src/propolis_server_cli.rs} (99%) rename progenitor-impl/tests/output/{propolis-server-httpmock.out => src/propolis_server_httpmock.rs} (99%) rename progenitor-impl/tests/output/{propolis-server-positional.out => src/propolis_server_positional.rs} (100%) rename progenitor-impl/tests/output/{test_default_params_builder.out => src/test_default_params_builder.rs} (100%) rename progenitor-impl/tests/output/{test_default_params_positional.out => src/test_default_params_positional.rs} (100%) rename progenitor-impl/tests/output/{test_freeform_response.out => src/test_freeform_response.rs} (100%) rename progenitor-impl/tests/output/{test_renamed_parameters.out => src/test_renamed_parameters.rs} (100%) diff --git a/.gitignore b/.gitignore index 2f7896d1..0c3d7f7e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ target/ + +progenitor-impl/tests/output/Cargo.lock diff --git a/progenitor-impl/tests/output/Cargo.toml b/progenitor-impl/tests/output/Cargo.toml new file mode 100644 index 00000000..bef1a073 --- /dev/null +++ b/progenitor-impl/tests/output/Cargo.toml @@ -0,0 +1,37 @@ +[workspace] + +[package] +name = "test-output" +version = "0.1.0" +edition = "2021" + +[dependencies] +base64 = "0.21" +chrono = { version = "0.4", features = ["serde"] } +clap = { version = "4", features = ["string"] } +futures = "0.3" +httpmock = "0.7" +progenitor-client = { path = "../../../progenitor-client" } +rand = { version = "0.8", features = ["serde1"] } +regex = "1.10" +regress = "0.7" +reqwest = "0.11" +schemars = { version = "0.8", features = ["chrono", "uuid1"] } +serde = { features = ["derive"], version = "1" } +serde_json = "1" +uuid = { features = ["serde", "v4"], version = "1" } + +[lints.rust] +unused_imports = "allow" +unused_variables= "allow" + +[lints.clippy] +needless_lifetimes = "allow" +redundant_field_names = "allow" +vec_init_then_push = "allow" +clone_on_copy = "allow" +unnecessary_to_owned = "allow" +to_string_in_format_args = "allow" +len_zero = "allow" +ptr_arg = "allow" +too_many_arguments = "allow" diff --git a/progenitor-impl/tests/output/buildomat-builder.out b/progenitor-impl/tests/output/src/buildomat_builder.rs similarity index 100% rename from progenitor-impl/tests/output/buildomat-builder.out rename to progenitor-impl/tests/output/src/buildomat_builder.rs diff --git a/progenitor-impl/tests/output/buildomat-builder-tagged.out b/progenitor-impl/tests/output/src/buildomat_builder_tagged.rs similarity index 100% rename from progenitor-impl/tests/output/buildomat-builder-tagged.out rename to progenitor-impl/tests/output/src/buildomat_builder_tagged.rs diff --git a/progenitor-impl/tests/output/buildomat-cli.out b/progenitor-impl/tests/output/src/buildomat_cli.rs similarity index 99% rename from progenitor-impl/tests/output/buildomat-cli.out rename to progenitor-impl/tests/output/src/buildomat_cli.rs index 3c61994a..14a535cd 100644 --- a/progenitor-impl/tests/output/buildomat-cli.out +++ b/progenitor-impl/tests/output/src/buildomat_cli.rs @@ -1,4 +1,4 @@ -use sdk::*; +use crate::buildomat_builder::*; pub struct Cli { client: Client, over: T, diff --git a/progenitor-impl/tests/output/buildomat-httpmock.out b/progenitor-impl/tests/output/src/buildomat_httpmock.rs similarity index 99% rename from progenitor-impl/tests/output/buildomat-httpmock.out rename to progenitor-impl/tests/output/src/buildomat_httpmock.rs index 1d25fd9c..a8895163 100644 --- a/progenitor-impl/tests/output/buildomat-httpmock.out +++ b/progenitor-impl/tests/output/src/buildomat_httpmock.rs @@ -3,7 +3,7 @@ pub mod operations { #![doc = r" wrappers for each operation. Each can be converted to"] #![doc = r" its inner type with a call to `into_inner()`. This can"] #![doc = r" be used to explicitly deviate from permitted values."] - use sdk::*; + use crate::buildomat_builder::*; pub struct ControlHoldWhen(httpmock::When); impl ControlHoldWhen { pub fn new(inner: httpmock::When) -> Self { diff --git a/progenitor-impl/tests/output/buildomat-positional.out b/progenitor-impl/tests/output/src/buildomat_positional.rs similarity index 100% rename from progenitor-impl/tests/output/buildomat-positional.out rename to progenitor-impl/tests/output/src/buildomat_positional.rs diff --git a/progenitor-impl/tests/output/keeper-builder.out b/progenitor-impl/tests/output/src/keeper_builder.rs similarity index 100% rename from progenitor-impl/tests/output/keeper-builder.out rename to progenitor-impl/tests/output/src/keeper_builder.rs diff --git a/progenitor-impl/tests/output/keeper-builder-tagged.out b/progenitor-impl/tests/output/src/keeper_builder_tagged.rs similarity index 100% rename from progenitor-impl/tests/output/keeper-builder-tagged.out rename to progenitor-impl/tests/output/src/keeper_builder_tagged.rs diff --git a/progenitor-impl/tests/output/keeper-cli.out b/progenitor-impl/tests/output/src/keeper_cli.rs similarity index 99% rename from progenitor-impl/tests/output/keeper-cli.out rename to progenitor-impl/tests/output/src/keeper_cli.rs index eb12f210..68c0a4a1 100644 --- a/progenitor-impl/tests/output/keeper-cli.out +++ b/progenitor-impl/tests/output/src/keeper_cli.rs @@ -1,4 +1,4 @@ -use sdk::*; +use crate::keeper_builder::*; pub struct Cli { client: Client, over: T, diff --git a/progenitor-impl/tests/output/keeper-httpmock.out b/progenitor-impl/tests/output/src/keeper_httpmock.rs similarity index 99% rename from progenitor-impl/tests/output/keeper-httpmock.out rename to progenitor-impl/tests/output/src/keeper_httpmock.rs index 0175d8f4..be29a510 100644 --- a/progenitor-impl/tests/output/keeper-httpmock.out +++ b/progenitor-impl/tests/output/src/keeper_httpmock.rs @@ -3,7 +3,7 @@ pub mod operations { #![doc = r" wrappers for each operation. Each can be converted to"] #![doc = r" its inner type with a call to `into_inner()`. This can"] #![doc = r" be used to explicitly deviate from permitted values."] - use sdk::*; + use crate::keeper_builder::*; pub struct EnrolWhen(httpmock::When); impl EnrolWhen { pub fn new(inner: httpmock::When) -> Self { diff --git a/progenitor-impl/tests/output/keeper-positional.out b/progenitor-impl/tests/output/src/keeper_positional.rs similarity index 100% rename from progenitor-impl/tests/output/keeper-positional.out rename to progenitor-impl/tests/output/src/keeper_positional.rs diff --git a/progenitor-impl/tests/output/src/lib.rs b/progenitor-impl/tests/output/src/lib.rs new file mode 100644 index 00000000..1bb9e956 --- /dev/null +++ b/progenitor-impl/tests/output/src/lib.rs @@ -0,0 +1,34 @@ +pub mod buildomat_builder; +pub mod buildomat_builder_tagged; +pub mod buildomat_cli; +//pub mod buildomat_httpmock; +pub mod buildomat_positional; +pub mod keeper_builder; +pub mod keeper_builder_tagged; +pub mod keeper_cli; +pub mod keeper_httpmock; +pub mod keeper_positional; +pub mod nexus_builder; +pub mod nexus_builder_tagged; +pub mod nexus_cli; +pub mod nexus_httpmock; +pub mod nexus_positional; +pub mod param_collision_builder; +pub mod param_collision_builder_tagged; +pub mod param_collision_cli; +pub mod param_collision_httpmock; +pub mod param_collision_positional; +pub mod param_overrides_builder; +pub mod param_overrides_builder_tagged; +pub mod param_overrides_cli; +pub mod param_overrides_httpmock; +pub mod param_overrides_positional; +pub mod propolis_server_builder; +pub mod propolis_server_builder_tagged; +pub mod propolis_server_cli; +//pub mod propolis_server_httpmock; +pub mod propolis_server_positional; +pub mod test_default_params_builder; +pub mod test_default_params_positional; +pub mod test_freeform_response; +pub mod test_renamed_parameters; diff --git a/progenitor-impl/tests/output/nexus-builder.out b/progenitor-impl/tests/output/src/nexus_builder.rs similarity index 100% rename from progenitor-impl/tests/output/nexus-builder.out rename to progenitor-impl/tests/output/src/nexus_builder.rs diff --git a/progenitor-impl/tests/output/nexus-builder-tagged.out b/progenitor-impl/tests/output/src/nexus_builder_tagged.rs similarity index 100% rename from progenitor-impl/tests/output/nexus-builder-tagged.out rename to progenitor-impl/tests/output/src/nexus_builder_tagged.rs diff --git a/progenitor-impl/tests/output/nexus-cli.out b/progenitor-impl/tests/output/src/nexus_cli.rs similarity index 99% rename from progenitor-impl/tests/output/nexus-cli.out rename to progenitor-impl/tests/output/src/nexus_cli.rs index ee41b2be..779c5789 100644 --- a/progenitor-impl/tests/output/nexus-cli.out +++ b/progenitor-impl/tests/output/src/nexus_cli.rs @@ -1,4 +1,4 @@ -use sdk::*; +use crate::nexus_builder::*; pub struct Cli { client: Client, over: T, diff --git a/progenitor-impl/tests/output/nexus-httpmock.out b/progenitor-impl/tests/output/src/nexus_httpmock.rs similarity index 99% rename from progenitor-impl/tests/output/nexus-httpmock.out rename to progenitor-impl/tests/output/src/nexus_httpmock.rs index b72ed5b1..9ae8fcd7 100644 --- a/progenitor-impl/tests/output/nexus-httpmock.out +++ b/progenitor-impl/tests/output/src/nexus_httpmock.rs @@ -3,7 +3,7 @@ pub mod operations { #![doc = r" wrappers for each operation. Each can be converted to"] #![doc = r" its inner type with a call to `into_inner()`. This can"] #![doc = r" be used to explicitly deviate from permitted values."] - use sdk::*; + use crate::nexus_builder::*; pub struct DiskViewByIdWhen(httpmock::When); impl DiskViewByIdWhen { pub fn new(inner: httpmock::When) -> Self { diff --git a/progenitor-impl/tests/output/nexus-positional.out b/progenitor-impl/tests/output/src/nexus_positional.rs similarity index 100% rename from progenitor-impl/tests/output/nexus-positional.out rename to progenitor-impl/tests/output/src/nexus_positional.rs diff --git a/progenitor-impl/tests/output/param-collision-builder.out b/progenitor-impl/tests/output/src/param_collision_builder.rs similarity index 100% rename from progenitor-impl/tests/output/param-collision-builder.out rename to progenitor-impl/tests/output/src/param_collision_builder.rs diff --git a/progenitor-impl/tests/output/param-collision-builder-tagged.out b/progenitor-impl/tests/output/src/param_collision_builder_tagged.rs similarity index 100% rename from progenitor-impl/tests/output/param-collision-builder-tagged.out rename to progenitor-impl/tests/output/src/param_collision_builder_tagged.rs diff --git a/progenitor-impl/tests/output/param-collision-cli.out b/progenitor-impl/tests/output/src/param_collision_cli.rs similarity index 99% rename from progenitor-impl/tests/output/param-collision-cli.out rename to progenitor-impl/tests/output/src/param_collision_cli.rs index 8a1f61ca..ab8fabd8 100644 --- a/progenitor-impl/tests/output/param-collision-cli.out +++ b/progenitor-impl/tests/output/src/param_collision_cli.rs @@ -1,4 +1,4 @@ -use sdk::*; +use crate::param_collision_builder::*; pub struct Cli { client: Client, over: T, diff --git a/progenitor-impl/tests/output/param-collision-httpmock.out b/progenitor-impl/tests/output/src/param_collision_httpmock.rs similarity index 98% rename from progenitor-impl/tests/output/param-collision-httpmock.out rename to progenitor-impl/tests/output/src/param_collision_httpmock.rs index dae5970e..f530e991 100644 --- a/progenitor-impl/tests/output/param-collision-httpmock.out +++ b/progenitor-impl/tests/output/src/param_collision_httpmock.rs @@ -3,7 +3,7 @@ pub mod operations { #![doc = r" wrappers for each operation. Each can be converted to"] #![doc = r" its inner type with a call to `into_inner()`. This can"] #![doc = r" be used to explicitly deviate from permitted values."] - use sdk::*; + use crate::param_collision_builder::*; pub struct KeyGetWhen(httpmock::When); impl KeyGetWhen { pub fn new(inner: httpmock::When) -> Self { diff --git a/progenitor-impl/tests/output/param-collision-positional.out b/progenitor-impl/tests/output/src/param_collision_positional.rs similarity index 100% rename from progenitor-impl/tests/output/param-collision-positional.out rename to progenitor-impl/tests/output/src/param_collision_positional.rs diff --git a/progenitor-impl/tests/output/param-overrides-builder.out b/progenitor-impl/tests/output/src/param_overrides_builder.rs similarity index 100% rename from progenitor-impl/tests/output/param-overrides-builder.out rename to progenitor-impl/tests/output/src/param_overrides_builder.rs diff --git a/progenitor-impl/tests/output/param-overrides-builder-tagged.out b/progenitor-impl/tests/output/src/param_overrides_builder_tagged.rs similarity index 100% rename from progenitor-impl/tests/output/param-overrides-builder-tagged.out rename to progenitor-impl/tests/output/src/param_overrides_builder_tagged.rs diff --git a/progenitor-impl/tests/output/param-overrides-cli.out b/progenitor-impl/tests/output/src/param_overrides_cli.rs similarity index 98% rename from progenitor-impl/tests/output/param-overrides-cli.out rename to progenitor-impl/tests/output/src/param_overrides_cli.rs index cac9f283..c151e7d1 100644 --- a/progenitor-impl/tests/output/param-overrides-cli.out +++ b/progenitor-impl/tests/output/src/param_overrides_cli.rs @@ -1,4 +1,4 @@ -use sdk::*; +use crate::param_overrides_builder::*; pub struct Cli { client: Client, over: T, diff --git a/progenitor-impl/tests/output/param-overrides-httpmock.out b/progenitor-impl/tests/output/src/param_overrides_httpmock.rs similarity index 98% rename from progenitor-impl/tests/output/param-overrides-httpmock.out rename to progenitor-impl/tests/output/src/param_overrides_httpmock.rs index e0d7fff7..5bfed110 100644 --- a/progenitor-impl/tests/output/param-overrides-httpmock.out +++ b/progenitor-impl/tests/output/src/param_overrides_httpmock.rs @@ -3,7 +3,7 @@ pub mod operations { #![doc = r" wrappers for each operation. Each can be converted to"] #![doc = r" its inner type with a call to `into_inner()`. This can"] #![doc = r" be used to explicitly deviate from permitted values."] - use sdk::*; + use crate::param_overrides_builder::*; pub struct KeyGetWhen(httpmock::When); impl KeyGetWhen { pub fn new(inner: httpmock::When) -> Self { diff --git a/progenitor-impl/tests/output/param-overrides-positional.out b/progenitor-impl/tests/output/src/param_overrides_positional.rs similarity index 100% rename from progenitor-impl/tests/output/param-overrides-positional.out rename to progenitor-impl/tests/output/src/param_overrides_positional.rs diff --git a/progenitor-impl/tests/output/propolis-server-builder.out b/progenitor-impl/tests/output/src/propolis_server_builder.rs similarity index 100% rename from progenitor-impl/tests/output/propolis-server-builder.out rename to progenitor-impl/tests/output/src/propolis_server_builder.rs diff --git a/progenitor-impl/tests/output/propolis-server-builder-tagged.out b/progenitor-impl/tests/output/src/propolis_server_builder_tagged.rs similarity index 100% rename from progenitor-impl/tests/output/propolis-server-builder-tagged.out rename to progenitor-impl/tests/output/src/propolis_server_builder_tagged.rs diff --git a/progenitor-impl/tests/output/propolis-server-cli.out b/progenitor-impl/tests/output/src/propolis_server_cli.rs similarity index 99% rename from progenitor-impl/tests/output/propolis-server-cli.out rename to progenitor-impl/tests/output/src/propolis_server_cli.rs index e92bc5eb..f7658103 100644 --- a/progenitor-impl/tests/output/propolis-server-cli.out +++ b/progenitor-impl/tests/output/src/propolis_server_cli.rs @@ -1,4 +1,4 @@ -use sdk::*; +use crate::propolis_server_builder::*; pub struct Cli { client: Client, over: T, diff --git a/progenitor-impl/tests/output/propolis-server-httpmock.out b/progenitor-impl/tests/output/src/propolis_server_httpmock.rs similarity index 99% rename from progenitor-impl/tests/output/propolis-server-httpmock.out rename to progenitor-impl/tests/output/src/propolis_server_httpmock.rs index 41937f33..3dce38fb 100644 --- a/progenitor-impl/tests/output/propolis-server-httpmock.out +++ b/progenitor-impl/tests/output/src/propolis_server_httpmock.rs @@ -3,7 +3,7 @@ pub mod operations { #![doc = r" wrappers for each operation. Each can be converted to"] #![doc = r" its inner type with a call to `into_inner()`. This can"] #![doc = r" be used to explicitly deviate from permitted values."] - use sdk::*; + use crate::propolis_server_builder::*; pub struct InstanceGetWhen(httpmock::When); impl InstanceGetWhen { pub fn new(inner: httpmock::When) -> Self { diff --git a/progenitor-impl/tests/output/propolis-server-positional.out b/progenitor-impl/tests/output/src/propolis_server_positional.rs similarity index 100% rename from progenitor-impl/tests/output/propolis-server-positional.out rename to progenitor-impl/tests/output/src/propolis_server_positional.rs diff --git a/progenitor-impl/tests/output/test_default_params_builder.out b/progenitor-impl/tests/output/src/test_default_params_builder.rs similarity index 100% rename from progenitor-impl/tests/output/test_default_params_builder.out rename to progenitor-impl/tests/output/src/test_default_params_builder.rs diff --git a/progenitor-impl/tests/output/test_default_params_positional.out b/progenitor-impl/tests/output/src/test_default_params_positional.rs similarity index 100% rename from progenitor-impl/tests/output/test_default_params_positional.out rename to progenitor-impl/tests/output/src/test_default_params_positional.rs diff --git a/progenitor-impl/tests/output/test_freeform_response.out b/progenitor-impl/tests/output/src/test_freeform_response.rs similarity index 100% rename from progenitor-impl/tests/output/test_freeform_response.out rename to progenitor-impl/tests/output/src/test_freeform_response.rs diff --git a/progenitor-impl/tests/output/test_renamed_parameters.out b/progenitor-impl/tests/output/src/test_renamed_parameters.rs similarity index 100% rename from progenitor-impl/tests/output/test_renamed_parameters.out rename to progenitor-impl/tests/output/src/test_renamed_parameters.rs diff --git a/progenitor-impl/tests/test_output.rs b/progenitor-impl/tests/test_output.rs index e910d975..7f55c884 100644 --- a/progenitor-impl/tests/test_output.rs +++ b/progenitor-impl/tests/test_output.rs @@ -49,7 +49,8 @@ fn reformat_code(content: TokenStream) -> String { fn verify_apis(openapi_file: &str) { let mut in_path = PathBuf::from("../sample_openapi"); in_path.push(openapi_file); - let openapi_stem = openapi_file.split('.').next().unwrap(); + let openapi_stem = + openapi_file.split('.').next().unwrap().replace('-', "_"); let spec = load_api(in_path); @@ -57,7 +58,7 @@ fn verify_apis(openapi_file: &str) { let mut generator = Generator::default(); let output = generate_formatted(&mut generator, &spec); expectorate::assert_contents( - format!("tests/output/{}-positional.out", openapi_stem), + format!("tests/output/src/{}_positional.rs", openapi_stem), &output, ); @@ -82,7 +83,7 @@ fn verify_apis(openapi_file: &str) { ); let output = generate_formatted(&mut generator, &spec); expectorate::assert_contents( - format!("tests/output/{}-builder.out", openapi_stem), + format!("tests/output/src/{}_builder.rs", openapi_stem), &output, ); @@ -94,21 +95,25 @@ fn verify_apis(openapi_file: &str) { ); let output = generate_formatted(&mut generator, &spec); expectorate::assert_contents( - format!("tests/output/{}-builder-tagged.out", openapi_stem), + format!("tests/output/src/{}_builder_tagged.rs", openapi_stem), &output, ); // CLI generation. - let tokens = generator.cli(&spec, "sdk").unwrap(); + let tokens = generator + .cli(&spec, &format!("crate::{openapi_stem}_builder")) + .unwrap(); let output = reformat_code(tokens); expectorate::assert_contents( - format!("tests/output/{}-cli.out", openapi_stem), + format!("tests/output/src/{}_cli.rs", openapi_stem), &output, ); // httpmock generation. - let code = generator.httpmock(&spec, "sdk").unwrap(); + let code = generator + .httpmock(&spec, &format!("crate::{openapi_stem}_builder")) + .unwrap(); // TODO pending #368 let output = rustfmt_wrapper::rustfmt_config( @@ -122,7 +127,7 @@ fn verify_apis(openapi_file: &str) { let output = progenitor_impl::space_out_items(output).unwrap(); expectorate::assert_contents( - format!("tests/output/{}-httpmock.out", openapi_stem), + format!("tests/output/src/{}_httpmock.rs", openapi_stem), &output, ); } diff --git a/progenitor-impl/tests/test_specific.rs b/progenitor-impl/tests/test_specific.rs index 4ca5f68b..60b2f644 100644 --- a/progenitor-impl/tests/test_specific.rs +++ b/progenitor-impl/tests/test_specific.rs @@ -82,7 +82,7 @@ fn test_renamed_parameters() { let mut generator = Generator::default(); let output = generate_formatted(&mut generator, &spec); expectorate::assert_contents( - format!("tests/output/{}.out", "test_renamed_parameters"), + format!("tests/output/src/{}.rs", "test_renamed_parameters"), &output, ) } @@ -115,7 +115,7 @@ fn test_freeform_response() { let mut generator = Generator::default(); let output = generate_formatted(&mut generator, &spec); expectorate::assert_contents( - format!("tests/output/{}.out", "test_freeform_response"), + format!("tests/output/src/{}.rs", "test_freeform_response"), &output, ) } @@ -169,7 +169,7 @@ fn test_default_params() { let mut generator = Generator::default(); let output = generate_formatted(&mut generator, &spec); expectorate::assert_contents( - format!("tests/output/{}.out", "test_default_params_positional"), + format!("tests/output/src/{}.rs", "test_default_params_positional"), &output, ); @@ -178,7 +178,7 @@ fn test_default_params() { ); let output = generate_formatted(&mut generator, &spec); expectorate::assert_contents( - format!("tests/output/{}.out", "test_default_params_builder"), + format!("tests/output/src/{}.rs", "test_default_params_builder"), &output, ); }