Skip to content

Commit

Permalink
remove error message check
Browse files Browse the repository at this point in the history
  • Loading branch information
dkijania committed Jul 9, 2020
1 parent 2683bbf commit 75927cc
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions vit-servicing-station-tests/src/tests/bootstrap/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,8 @@ use std::{
#[test]
pub fn no_in_settings_provided() {
let command_builder: BootstrapCommandBuilder = Default::default();
let assert = command_builder.build().assert().failure();

let predicate = predicate::str::contains("Error connecting to database");
assert_stdout_or_stderr(assert, predicate);
}

fn assert_stdout_or_stderr(assert: Assert, predicate: ContainsPredicate) {
let output = assert.get_output();
if output.stdout.len() > 0 {
assert.stdout(predicate);
} else {
assert.stderr(predicate);
}
command_builder.build().assert().failure();
}

#[test]
pub fn in_settings_file_does_not_exist() {
let mut command_builder: BootstrapCommandBuilder = Default::default();
Expand All @@ -43,8 +30,7 @@ pub fn in_settings_file_does_not_exist() {
.in_settings_file(&non_existing_file)
.build()
.assert()
.failure()
.stderr(predicate::str::contains("Error reading file"));
.failure();
}

#[test]
Expand All @@ -62,14 +48,11 @@ pub fn in_settings_file_malformed() {
remove_first_char_in_file(&settings_file);

let mut command_builder: BootstrapCommandBuilder = Default::default();
let assert = command_builder
command_builder
.in_settings_file(&settings_file)
.build()
.assert()
.failure();

let predicate = predicate::str::contains("Error loading settings from file");
assert_stdout_or_stderr(assert, predicate);
}

pub fn remove_first_char_in_file(settings_file: &PathBuf) {
Expand All @@ -91,6 +74,5 @@ pub fn in_settings_file_with_malformed_path() {
.in_settings_file(&non_existing_file)
.build()
.assert()
.failure()
.stderr(predicate::str::contains("Error reading file"));
.failure();
}

0 comments on commit 75927cc

Please sign in to comment.