summaryrefslogtreecommitdiff
path: root/tests/config_tests.rs
diff options
context:
space:
mode:
authorArthur Taylor <codders@octomonkey.org.uk>2016-11-22 10:56:20 +0100
committerGitHub <noreply@github.com>2016-11-22 10:56:20 +0100
commit8e9d234dcfe03a24409829ddd31b51bd8f840345 (patch)
treed1d833d732faf4c8709e975a4bb6129acc3d0f76 /tests/config_tests.rs
parent0167dce98692f707b74395977c478c2ca44fa0c7 (diff)
parent4b50e1cb0945adbbcc07dfcb65a9252e7523105d (diff)
downloadrvi_sota_client-8e9d234dcfe03a24409829ddd31b51bd8f840345.tar.gz
Merge pull request #9 from advancedtelematic/stableHEADmaster
Merge latest stable advancedtelematic
Diffstat (limited to 'tests/config_tests.rs')
-rw-r--r--tests/config_tests.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/config_tests.rs b/tests/config_tests.rs
new file mode 100644
index 0000000..21dcb4e
--- /dev/null
+++ b/tests/config_tests.rs
@@ -0,0 +1,36 @@
+use std::env;
+use std::path::Path;
+use std::process::{Command, Output};
+
+
+fn run_client(config: &str) -> Output {
+ let out_dir = env::var("OUT_DIR").expect("expected OUT_DIR environment variable");
+ let bin_dir = Path::new(&out_dir).parent().unwrap().parent().unwrap().parent().unwrap();
+
+ Command::new(format!("{}/sota_client", bin_dir.to_str().unwrap()))
+ .arg("--print")
+ .arg(format!("--config={}", config))
+ .output()
+ .unwrap_or_else(|err| panic!("couldn't start client: {}", err))
+}
+
+
+#[test]
+fn default_config() {
+ assert!(run_client("tests/toml/default.toml").status.success());
+}
+
+#[test]
+fn genivi_config() {
+ assert!(run_client("tests/toml/genivi.toml").status.success());
+}
+
+#[test]
+fn old_config() {
+ assert!(run_client("tests/toml/old.toml").status.success());
+}
+
+#[test]
+fn polling_config() {
+ assert!(run_client("tests/toml/polling.toml").status.success() != true);
+}