Search in sources :

Example 6 with WebDavStore

use of com.fsck.k9.mail.store.webdav.WebDavStore 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 7 with WebDavStore

use of com.fsck.k9.mail.store.webdav.WebDavStore 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 8 with WebDavStore

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

the class WebDavStoreTest method getFolder_shouldReturnWebDavFolderInstance.

@Test
public void getFolder_shouldReturnWebDavFolderInstance() throws Exception {
    WebDavStore webDavStore = createDefaultWebDavStore();
    Folder result = webDavStore.getFolder("INBOX");
    assertEquals(WebDavFolder.class, result.getClass());
}
Also used : Folder(com.fsck.k9.mail.Folder) Test(org.junit.Test)

Example 9 with WebDavStore

use of com.fsck.k9.mail.store.webdav.WebDavStore 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

Test (org.junit.Test)7 StoreConfig (com.fsck.k9.mail.store.StoreConfig)5 Folder (com.fsck.k9.mail.Folder)2 ConnectivityManager (android.net.ConnectivityManager)1 ConnectionSecurity (com.fsck.k9.mail.ConnectionSecurity)1 MessagingException (com.fsck.k9.mail.MessagingException)1 Store (com.fsck.k9.mail.Store)1 OAuth2TokenProvider (com.fsck.k9.mail.oauth.OAuth2TokenProvider)1 DefaultTrustedSocketFactory (com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory)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 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1