Create test mailboxes

This commit is contained in:
Jan Berkel 2015-01-14 03:08:44 +01:00
parent 055d4104b7
commit 0f312f012e
1 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,9 @@
package com.fsck.k9.endtoend.framework;
import android.util.Log;
import com.fsck.k9.K9;
import com.icegreen.greenmail.user.GreenMailUser;
import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.ServerSetup;
@ -18,7 +22,18 @@ public class StubMailServer {
public StubMailServer() {
greenmail = new GreenMail(new ServerSetup[]{IMAP_SERVER_SETUP, SMTP_SERVER_SETUP});
greenmail.setUser(UserForImap.TEST_USER.emailAddress, UserForImap.TEST_USER.loginUsername, UserForImap.TEST_USER.password);
GreenMailUser user = greenmail
.setUser(UserForImap.TEST_USER.emailAddress, UserForImap.TEST_USER.loginUsername,
UserForImap.TEST_USER.password);
for (String mailbox : new String[] {"Drafts", "Spam"}) {
Log.d(K9.LOG_TAG, "creating mailbox "+mailbox);
try {
greenmail.getManagers().getImapHostManager().createMailbox(user, mailbox);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
greenmail.start();
}