Search in sources :

Example 6 with StoreConfig

use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.

the class WebDavStoreTest method createStoreConfig.

private StoreConfig createStoreConfig(String storeUri) {
    StoreConfig storeConfig = mock(StoreConfig.class);
    when(storeConfig.getInboxFolderName()).thenReturn("INBOX");
    when(storeConfig.getStoreUri()).thenReturn(storeUri);
    return storeConfig;
}
Also used : StoreConfig(com.fsck.k9.mail.store.StoreConfig)

Example 7 with StoreConfig

use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.

the class WebDavStoreTest method getPersonalNamespaces_shouldRequestSpecialFolders.

@Test
public void getPersonalNamespaces_shouldRequestSpecialFolders() throws Exception {
    StoreConfig storeConfig = createStoreConfig("webdav://user:password@example.org:80");
    WebDavStore webDavStore = new WebDavStore(storeConfig, mockHttpClientFactory);
    configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(), createOkSearchResponse());
    webDavStore.getPersonalNamespaces(true);
    List<HttpGeneric> requests = requestCaptor.getAllValues();
    // AUTH + 2
    assertEquals(4, requests.size());
    //Special Folders
    assertEquals("PROPFIND", requests.get(2).getMethod());
}
Also used : StoreConfig(com.fsck.k9.mail.store.StoreConfig) Test(org.junit.Test)

Example 8 with StoreConfig

use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.

the class WebDavStoreTest method getPersonalNamespaces_shouldSetSpecialFolderNames.

@Test
public void getPersonalNamespaces_shouldSetSpecialFolderNames() throws Exception {
    StoreConfig storeConfig = createStoreConfig("webdav://user:password@example.org:80");
    WebDavStore webDavStore = new WebDavStore(storeConfig, mockHttpClientFactory);
    configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(), createOkSearchResponse());
    webDavStore.getPersonalNamespaces(true);
    verify(storeConfig).setInboxFolderName("Inbox");
}
Also used : StoreConfig(com.fsck.k9.mail.store.StoreConfig) Test(org.junit.Test)

Example 9 with StoreConfig

use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.

the class WebDavStoreTest method getPersonalNamespaces_shouldRequestFolderList.

@Test
public void getPersonalNamespaces_shouldRequestFolderList() throws Exception {
    StoreConfig storeConfig = createStoreConfig("webdav://user:password@example.org:80");
    WebDavStore webDavStore = new WebDavStore(storeConfig, mockHttpClientFactory);
    configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(), createOkSearchResponse());
    webDavStore.getPersonalNamespaces(true);
    List<HttpGeneric> requests = requestCaptor.getAllValues();
    // AUTH + SPECIALFOLDERS + 1
    assertEquals(4, requests.size());
    assertEquals("SEARCH", requests.get(3).getMethod());
}
Also used : StoreConfig(com.fsck.k9.mail.store.StoreConfig) Test(org.junit.Test)

Example 10 with StoreConfig

use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.

the class WebDavStoreTest method constructor_withImapStoreUri_shouldThrow.

@Test(expected = MessagingException.class)
public void constructor_withImapStoreUri_shouldThrow() throws Exception {
    StoreConfig storeConfig = createStoreConfig("imap://user:password@imap.example.org");
    new WebDavStore(storeConfig, mockHttpClientFactory);
}
Also used : StoreConfig(com.fsck.k9.mail.store.StoreConfig) Test(org.junit.Test)

Aggregations

StoreConfig (com.fsck.k9.mail.store.StoreConfig)11 Test (org.junit.Test)8 ConnectivityManager (android.net.ConnectivityManager)2 XOAuth2ChallengeParserTest (com.fsck.k9.mail.XOAuth2ChallengeParserTest)2 OAuth2TokenProvider (com.fsck.k9.mail.oauth.OAuth2TokenProvider)2 MessagingException (com.fsck.k9.mail.MessagingException)1 Store (com.fsck.k9.mail.Store)1 DefaultTrustedSocketFactory (com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory)1 TrustedSocketFactory (com.fsck.k9.mail.ssl.TrustedSocketFactory)1 ImapStore (com.fsck.k9.mail.store.imap.ImapStore)1 Pop3Store (com.fsck.k9.mail.store.pop3.Pop3Store)1 WebDavStore (com.fsck.k9.mail.store.webdav.WebDavStore)1 Before (org.junit.Before)1