Added a test console
ci/woodpecker/push/woodpecker Pipeline failed Details

This commit is contained in:
Martin Slot 2022-12-10 13:49:05 +01:00
parent 48e78cebff
commit c5b457accd
5 changed files with 37 additions and 0 deletions

3
.gitignore vendored
View File

@ -16,4 +16,7 @@ Cargo.lock
# Rider
.idea
/cobertura.xml
# binary specific
/tests/version_checker_db
/test_console/src/settings.development.toml

View File

@ -3,5 +3,6 @@
members = [
"application",
"console",
"test_console",
"tests",
]

9
test_console/Cargo.toml Normal file
View File

@ -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" }

21
test_console/src/main.rs Normal file
View File

@ -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, &notification, parser, args);
application.run();
}

View File

@ -0,0 +1,3 @@
[database]
connection_string = "version_checker_db"
in_memory = false