From bd0551b22076b82a6d49e9f7a2b2e0c90a1b2326 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 05 Feb 2016 07:25:27 -0500
Subject: [PATCH] Secure also downloads of addressbook exports, managesieve script exports and Enigma keys exports

---
 tests/Selenium/Mail/Getunread.php |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/tests/Selenium/Mail/Getunread.php b/tests/Selenium/Mail/Getunread.php
index d6362f2..c18ddc0 100644
--- a/tests/Selenium/Mail/Getunread.php
+++ b/tests/Selenium/Mail/Getunread.php
@@ -2,12 +2,36 @@
 
 class Selenium_Mail_Getunread extends Selenium_Test
 {
+    protected $msgcount = 0;
+
+    protected function setUp()
+    {
+        parent::setUp();
+
+        bootstrap::init_imap();
+        bootstrap::purge_mailbox('INBOX');
+
+        // import email messages
+        foreach (glob(TESTS_DIR . 'Selenium/data/mail/list_*.eml') as $f) {
+            bootstrap::import_message($f, 'INBOX');
+            $this->msgcount++;
+        }
+    }
+
     public function testGetunread()
     {
         $this->go('mail');
 
         $res = $this->ajaxResponse('getunread', "rcmail.http_request('getunread')");
-
         $this->assertEquals('getunread', $res['action']);
+
+        $env = $this->get_env();
+        $this->assertEquals($env['unread_counts']['INBOX'], $this->msgcount);
+
+        $li = $this->byCssSelector('.folderlist li.inbox');
+        $this->assertHasClass('unread', $li);
+
+        $badge = $this->byCssSelector('.folderlist li.inbox span.unreadcount');
+        $this->assertEquals(strval($this->msgcount), $this->getText($badge));
     }
 }

--
Gitblit v1.9.1