aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2018-11-09 20:46:08 +0100
committerTeddy Wing2018-11-09 20:46:08 +0100
commitd7baf68d21a34e51b3ff193fc2d7513c7c270e6c (patch)
tree5d53fc552571f6a0e5fe9827ee4c23f8723b188f /license-generator/src/main.rs
parent1c3e4bc7817b6b802e02cbf6c97e95752b2d9f45 (diff)
downloaddome-key-web-d7baf68d21a34e51b3ff193fc2d7513c7c270e6c.tar.bz2
main(): Create a test purchaser
Manually check that our purchaser creation and database persistence works. Make `purchaser` entities public in order to call them.
Diffstat (limited to 'license-generator/src/main.rs')
-rw-r--r--license-generator/src/main.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/license-generator/src/main.rs b/license-generator/src/main.rs
index 32fdc3b..5c1a0aa 100644
--- a/license-generator/src/main.rs
+++ b/license-generator/src/main.rs
@@ -15,6 +15,7 @@ use simplelog::{Config, LevelFilter, WriteLogger};
use license_generator::database;
use license_generator::errors::*;
+use license_generator::purchaser::Purchaser;
fn main() -> Result<()> {
let log_file_path = env::var("LOG_FILE")?;
@@ -26,7 +27,7 @@ fn main() -> Result<()> {
WriteLogger::init(LevelFilter::Info, Config::default(), log_file)?;
- let cx = match database::get_database_connection()
+ let mut cx = match database::get_database_connection()
.chain_err(|| "failed to create a database connection")
{
Ok(cx) => cx,
@@ -36,6 +37,12 @@ fn main() -> Result<()> {
},
};
+ let test_purchaser = Purchaser::new("Shiki", "shiki@example.com");
+ match test_purchaser.insert(&mut cx) {
+ Ok(_) => (),
+ Err(e) => error!("{}", e),
+ }
+
fastcgi::run(|mut req| {
write!(&mut req.stdout(), "Content-Type: text/plain\n\nHello, world!")
.unwrap_or(());