Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-10-15 12:24:38 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-10-30 19:16:24 +0300
commit15867528b25cad3e1262014d0fa4f967a73d64be (patch)
tree6dd7c46876325acf8aad147b9ef791a73376c102 /tests/Integration
parentfe074001833362fa1eb4d18576131b0678907fb5 (diff)
Store special mailboxes as preference of the account
… instead of using a fragile autodetection every time we need one of those. We will still try to auto-detect the mailboxes but the users will have to option to change the destinations. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/Integration')
-rw-r--r--tests/Integration/Db/MailAccountTest.php6
-rw-r--r--tests/Integration/Db/MailboxMapperTest.php34
-rw-r--r--tests/Integration/Service/MailTransmissionIntegrationTest.php5
3 files changed, 11 insertions, 34 deletions
diff --git a/tests/Integration/Db/MailAccountTest.php b/tests/Integration/Db/MailAccountTest.php
index c05f4c342..8bf2af949 100644
--- a/tests/Integration/Db/MailAccountTest.php
+++ b/tests/Integration/Db/MailAccountTest.php
@@ -66,6 +66,9 @@ class MailAccountTest extends TestCase {
'order' => 13,
'showSubscribedOnly' => null,
'personalNamespace' => null,
+ 'draftsMailboxId' => null,
+ 'sentMailboxId' => null,
+ 'trashMailboxId' => null,
], $a->toJson());
}
@@ -89,6 +92,9 @@ class MailAccountTest extends TestCase {
'order' => null,
'showSubscribedOnly' => null,
'personalNamespace' => null,
+ 'draftsMailboxId' => null,
+ 'sentMailboxId' => null,
+ 'trashMailboxId' => null,
];
$a = new MailAccount($expected);
// TODO: fix inconsistency
diff --git a/tests/Integration/Db/MailboxMapperTest.php b/tests/Integration/Db/MailboxMapperTest.php
index d086d993a..9c67c0664 100644
--- a/tests/Integration/Db/MailboxMapperTest.php
+++ b/tests/Integration/Db/MailboxMapperTest.php
@@ -129,38 +129,4 @@ class MailboxMapperTest extends TestCase {
$this->assertSame('INBOX', $result->getName());
}
-
- public function testNoTrashFound() {
- /** @var Account|MockObject $account */
- $account = $this->createMock(Account::class);
- $account->method('getId')->willReturn(13);
- $this->expectException(DoesNotExistException::class);
-
- $this->mapper->findSpecial($account, 'trash');
- }
-
- public function testFindTrash() {
- /** @var Account|MockObject $account */
- $account = $this->createMock(Account::class);
- $account->method('getId')->willReturn(13);
- $qb = $this->db->getQueryBuilder();
- $insert = $qb->insert($this->mapper->getTableName())
- ->values([
- 'name' => $qb->createNamedParameter('Trash'),
- 'account_id' => $qb->createNamedParameter(13, IQueryBuilder::PARAM_INT),
- 'sync_new_token' => $qb->createNamedParameter('VTEsVjE0Mjg1OTkxNDk='),
- 'sync_changed_token' => $qb->createNamedParameter('VTEsVjE0Mjg1OTkxNDk='),
- 'sync_vanished_token' => $qb->createNamedParameter('VTEsVjE0Mjg1OTkxNDk='),
- 'delimiter' => $qb->createNamedParameter('.'),
- 'messages' => $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT),
- 'unseen' => $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT),
- 'selectable' => $qb->createNamedParameter(true, IQueryBuilder::PARAM_BOOL),
- 'special_use' => $qb->createNamedParameter(json_encode(['trash'])),
- ]);
- $insert->execute();
-
- $result = $this->mapper->findSpecial($account, 'trash');
-
- $this->assertSame('Trash', $result->getName());
- }
}
diff --git a/tests/Integration/Service/MailTransmissionIntegrationTest.php b/tests/Integration/Service/MailTransmissionIntegrationTest.php
index 097b20313..8540465dc 100644
--- a/tests/Integration/Service/MailTransmissionIntegrationTest.php
+++ b/tests/Integration/Service/MailTransmissionIntegrationTest.php
@@ -95,6 +95,11 @@ class MailTransmissionIntegrationTest extends TestCase {
$this->attachmentService = OC::$server->query(IAttachmentService::class);
$userFolder = OC::$server->getUserFolder($this->user->getUID());
+ // Make sure the mailbox preferences are set
+ /** @var MailboxSync $mbSync */
+ $mbSync = OC::$server->query(MailboxSync::class);
+ $mbSync->sync($this->account, new NullLogger(), true);
+
$this->transmission = new MailTransmission(
$userFolder,
$this->attachmentService,