Merge branch '2015.11' into 2016.11
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 29 Aug 2016 07:37:11 +0000 (09:37 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 29 Aug 2016 07:37:11 +0000 (09:37 +0200)
1  2 
tests/tine20/Felamimail/Frontend/JsonTest.php

@@@ -567,18 -567,15 +567,18 @@@ class Felamimail_Frontend_JsonTest exte
       */
      public function testSendMessageToInvalidRecipient()
      {
 +        $this->markTestSkipped('FIXME: 0011802: Felamimail_Frontend_JsonTest::testSendMessageToInvalidRecipient fails');
 +
          $messageToSend = $this->_getMessageData($this->_account->email);
          $invalidEmail = 'invaliduser@' . $this->_mailDomain;
          $messageToSend['to'] = array($invalidEmail);
 +        $translation = Tinebase_Translation::getTranslation('Felamimail');
          
          try {
              $returned = $this->_json->saveMessage($messageToSend);
              $this->fail('Tinebase_Exception_SystemGeneric expected');
          } catch (Tinebase_Exception_SystemGeneric $tesg) {
 -            $this->assertContains('550 5.1.1 <' . $invalidEmail . '>: Recipient address rejected', $tesg->getMessage(),
 +            $this->assertContains('<' . $invalidEmail . '>: ' . $translation->_('Recipient address rejected'), $tesg->getMessage(),
                  'exception message did not match: ' . $tesg->getMessage());
          }
      }
              'field' => 'id', 'operator' => 'in', 'value' => array($message['id'])
          )), $testFolder->getId());
  
+         // sleep for 2 secs because mailserver may be slower than expected
+         sleep(2);
          $inboxAfter = $this->_getFolder('INBOX');
          
          // check if count was decreased correctly
          $fullMessage = $this->_json->getMessage($message['id']);
          $this->assertTrue(empty($fullMessage->preparedParts));
      }
 -    
 +
 +    /**
 +     * testSendMailveopeAPIMessage
 +     *
 +     * - envolpe amored message into PGP MIME structure
 +     */
 +    public function testSendMailveopeAPIMessage()
 +    {
 +        $subject = 'testSendMailveopeAPIMessage';
 +        $messageData = $this->_getMessageData('', $subject);
 +        $messageData['body'] = '-----BEGIN PGP MESSAGE-----
 +Version: Mailvelope v1.3.3
 +Comment: https://www.mailvelope.com
 +
 +wcFM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Uv6kEKv3EUDsRYu1SlDLhDLhWNx8RJae5XkMR+eUUMyNNVwbeMQbB
 +VAcMcaPITTk84sH7XElr9eF6sCUN4V79OSBRPGY/aNGrcwcoDSD4Hwu+Lw9w
 +Q+1n8EQ66gAkbJzCNd5GaYMZR9echkBaD/rdWDS3ktcrMehra+h44MTQONV9
 +8W+RI+IT5jaIXtB4jePmGjsJjbC9aEhTRBRkUnPA7phgknc52dD74AY/6lzK
 +yd4uZ6S3vhurJW0Vt4iBWJzhFNiSODh5PzteeNzCVAkGMsQvy1IHk0d3uzcE
 +0tEuSh8fZOFGB4fvMx9Mk8oAU92wfj4J7AVpSo5oRdxMqAXfaYKqfr2Gn++q
 +E5LClhVIBbFXclCoe0RYNz4wtxjeeYbP40Bq5g0JvPutD/dBMp8hz8Qt+yyG
 +d8X4/KmQIXyFZ8aP17GMckE5GVVvY9y89eWnWuTUJdwM540hB/EJNeHHTE5y
 +N2FSLGcmNkvE+3H7BczQ2ZI1SZDhof+umbUst0qoQW+hHmY3CSma48yGAVox
 +52u2t7hosHCfpf631Ve/6fcICo8vJ2Qfufu2BGIMlSfx4WzUuaMQBynuxFSa
 +IbVx8ZTO7dJRKrg72aFmWTf0uNla7vicAhpiLWobyNYcZbIjrAGDfg==
 +=BaAn
 +-----END PGP MESSAGE-----';
 +
 +        $this->_foldersToClear[] = 'INBOX';
 +        $this->_json->saveMessage($messageData);
 +
 +        $message = $this->_searchForMessageBySubject(Tinebase_Core::filterInputForDatabase($subject));
 +        $fullMessage = $this->_json->getMessage($message['id']);
 +
 +        $this->assertContains('multipart/encrypted', $fullMessage['headers']['content-type']);
 +        $this->assertContains('protocol="application/pgp-encrypted"', $fullMessage['headers']['content-type']);
 +        $this->assertCount(2, $fullMessage['structure']['parts']);
 +        $this->assertEquals('application/pgp-encrypted', $fullMessage['structure']['parts'][1]['contentType']);
 +        $this->assertEquals('application/octet-stream', $fullMessage['structure']['parts'][2]['contentType']);
 +
 +        return $fullMessage;
 +    }
 +
 +    /**
 +     * testMessagePGPMime
 +     *
 +     * - prepare amored part of PGP MIME structure
 +     */
 +    public function testMessagePGPMime()
 +    {
 +        $fullMessage = $this->testSendMailveopeAPIMessage();
 +
 +        $this->assertEquals('application/pgp-encrypted', $fullMessage['preparedParts'][0]['contentType']);
 +        $this->assertContains('-----BEGIN PGP MESSAGE-----', $fullMessage['preparedParts'][0]['preparedData']);
 +    }
 +
 +    public function testMessagePGPInline()
 +    {
 +        $inbox = $this->_getFolder('INBOX');
 +        $mailAsString = file_get_contents(dirname(__FILE__) . '/../files/multipart_alternative_pgp_inline.eml');
 +        Felamimail_Controller_Message::getInstance()->appendMessage($inbox, $mailAsString);
 +
 +        $this->_foldersToClear = array('INBOX');
 +        $message = $this->_searchForMessageBySubject('Re: mailvelope und tine20');
 +
 +        $fullMessage = $this->_json->getMessage($message['id']);
 +        $this->assertFalse(empty($fullMessage['preparedParts']));
 +    }
 +
      /*********************** sieve tests ****************************/
      
      /**