1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 09:08:49 -05:00

Create test mailboxes

This commit is contained in:
Jan Berkel 2015-01-14 03:08:44 +01:00
parent 055d4104b7
commit 0f312f012e

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();
}