test that bad credentials do not panic

This commit is contained in:
B. Petersen
2019-09-19 18:03:52 +02:00
committed by holger krekel
parent bbb8144129
commit bbff1c9c3e

View File

@@ -660,3 +660,32 @@ pub fn read_autoconf_file(context: &Context, url: &str) -> *mut libc::c_char {
}
}
}
#[cfg(test)]
mod tests {
use crate::test_utils::*;
use crate::config::*;
use crate::configure::dc_job_do_DC_JOB_CONFIGURE_IMAP;
use crate::job::*;
use crate::param::*;
#[test]
fn test_no_panic_on_bad_credentials() {
let t = dummy_context();
t.ctx.set_config(Config::Addr, Some("probably@unexistant.addr")).unwrap();
t.ctx.set_config(Config::MailPw, Some("123456")).unwrap();
let job = Job {
job_id: 1,
action: Action::ConfigureImap,
foreign_id: 0,
desired_timestamp: 0,
added_timestamp: 0,
tries: 0,
param: Params::new(),
try_again: 0,
pending_error: None,
};
unsafe { dc_job_do_DC_JOB_CONFIGURE_IMAP(&t.ctx, &job); }
}
}