Commit 844d3715 authored by MrMan's avatar MrMan

Fix tests

parent 216fb47e
Pipeline #50071266 passed with stage
in 7 minutes and 18 seconds
......@@ -106,7 +106,7 @@ mod tests {
use models::user::MailboxUser;
use models::{DBEntity, ModelWithUUID, PaginationOptions};
const TEST_USER_EMAIL: &'static str = "/var/mail/test";
const TEST_USER_HOME: &'static str = "/var/mail/test";
const TEST_USER_EMAIL: &'static str = "[email protected]";
const TEST_USER_DOMAIN: &'static str = "localhost";
const TEST_USER_PASSWORD: &'static str = "test";
......@@ -131,7 +131,7 @@ mod tests {
String::from(ADMIN_USER_HOME),
String::from(ADMIN_USER_EMAIL),
String::from(ADMIN_USER_PASSWORD),
);
)
}
#[test]
......
......@@ -4,6 +4,7 @@ pub fn test_user() -> MailboxUser {
MailboxUser {
username: String::from("test"),
domain: String::from("localhost"),
home: String::from("/var/mail/test"),
password: String::from("test"),
quota_gb: 5
}
......
......@@ -150,7 +150,7 @@ impl DockerizedPostmgr {
/// Connect to the instance over TCP
pub fn connect_tcp(&self) -> Result<(TcpStream, BufReader<TcpStream>), IOError> {
let stream = TcpStream::connect(self.get_smtp_address())?;
let mut reader = BufReader::new(stream.try_clone()?);
let reader = BufReader::new(stream.try_clone()?);
Ok((stream, reader))
}
......
extern crate reqwest;
use std::net::TcpStream;
use std::io::{Write, BufRead, BufReader};
use reqwest::header::COOKIE;
use std::io::{BufReader};
mod common;
use crate::common::DockerizedPostmgr;
......@@ -10,9 +9,6 @@ use crate::common::fixtures;
use common::{
DOMAIN_NAME,
POSTMASTER_AT_LOCALHOST,
CR_LF_END,
SMTP_B64_USERNAME_PROMPT,
SMTP_B64_PASSWORD_PROMPT,
read_ehlo,
send_ehlo,
......@@ -30,7 +26,7 @@ pub fn test_connect() {
let postmgr = DockerizedPostmgr::new().start();
// Connect to the postmgr over port 25
let mut stream = TcpStream::connect(postmgr.get_smtp_address()).unwrap();
let stream = TcpStream::connect(postmgr.get_smtp_address()).unwrap();
let mut reader = BufReader::new(stream.try_clone().unwrap());
// Read the response (connection should send SMTP response)
......@@ -61,8 +57,8 @@ pub fn test_email_send() {
#[test]
#[ignore]
///T est user creation & interaction over basic SMTP relay
pub fn test_user_creation() {
/// Test user creation & interaction over basic SMTP relay
// Start postmgr in a docker container
let postmgr = DockerizedPostmgr::new().start();
......@@ -74,7 +70,7 @@ pub fn test_user_creation() {
// Add a new user
let url = format!("http://{}/{}", &base_url, "api/v1/users");
let test_user = fixtures::test_user();
let mut resp = client.post(url.as_str())
let resp = client.post(url.as_str())
.json(&test_user)
.send()
.expect("failed to POST new user");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment