diff --git a/.gitignore b/.gitignore index a8f06ac..87c23dd 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,7 @@ Cargo.lock # Rider .idea /cobertura.xml + +# binary specific /tests/version_checker_db +/test_console/src/settings.development.toml diff --git a/Cargo.toml b/Cargo.toml index 06a897f..0b16255 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,5 +3,6 @@ members = [ "application", "console", + "test_console", "tests", ] diff --git a/test_console/Cargo.toml b/test_console/Cargo.toml new file mode 100644 index 0000000..d107fa2 --- /dev/null +++ b/test_console/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "test_console" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +application = { path = "../application" } diff --git a/test_console/src/main.rs b/test_console/src/main.rs new file mode 100644 index 0000000..1477546 --- /dev/null +++ b/test_console/src/main.rs @@ -0,0 +1,21 @@ +/* + I use this as a test bench instead of running the binary from a terminal. + TODO: i might change this to a test, that is muted somehow, but through configuration can be wired + to a real SMTP server, so i can test the full flow of the binary +*/ +fn main() { + let parser = ArgumentParser {}; + let settings = Settings::new(None).unwrap(); + let console = Console {}; + + let notification = EmailNotification { + smtp_relay: settings.email.smtp_relay.clone(), + smtp_username: settings.email.smtp_username.clone(), + smtp_password: settings.email.smtp_password.clone(), + from: settings.email.from.clone(), + }; + let args = std::env::args().collect(); + let application = Application::new(&settings, &console, ¬ification, parser, args); + + application.run(); +} diff --git a/test_console/src/settings.toml b/test_console/src/settings.toml new file mode 100644 index 0000000..d293a52 --- /dev/null +++ b/test_console/src/settings.toml @@ -0,0 +1,3 @@ +[database] +connection_string = "version_checker_db" +in_memory = false