@@ -0,0 +1,2344 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2015-2016:%0A#   Matthieu Estrada, ttamalfor@gmail.com%0A#%0A# This file is part of (AlignakApp).%0A#%0A# (AlignakApp) is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either version 3 of the License, or%0A# (at your option) any later version.%0A#%0A# (AlignakApp) is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A# GNU Affero General Public License for more details.%0A#%0A# You should have received a copy of the GNU Affero General Public License%0A# along with (AlignakApp).  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A%0Aimport unittest2%0Aimport configparser%0Aimport sys%0Aimport os%0A%0Afrom alignak_app.tray_icon import TrayIcon%0Afrom alignak_app.utils import get_alignak_home%0A%0Atry:%0A    __import__('PyQt5')%0A    from PyQt5.QtWidgets import QApplication%0A    from PyQt5.QtGui import QIcon%0A    from PyQt5.QtWidgets import QMenu%0Aexcept ImportError:%0A    from PyQt4.QtGui import QIcon%0A    from PyQt4.Qt import QApplication%0A    from PyQt4.Qt import QMenu%0A%0A%0Aclass TestTrayIcon(unittest2.TestCase):%0A    %22%22%22%0A        This file test the TrayIcon class.%0A    %22%22%22%0A%0A    config_file = get_alignak_home() + '/alignak_app/settings.cfg'%0A    config = configparser.ConfigParser()%0A    config.read(config_file)%0A%0A    qicon_path = get_alignak_home() %5C%0A                 + config.get('Config', 'path') %5C%0A                 + config.get('Config', 'img') %5C%0A                 + '/'%0A    img = os.path.abspath(qicon_path + config.get('Config', 'icon'))%0A    icon = QIcon(img)%0A%0A    @classmethod%0A    def setUpClass(cls):%0A        %22%22%22Create QApplication%22%22%22%0A        try:%0A            cls.app = QApplication(sys.argv)%0A        except:%0A            pass%0A%0A    def test_tray_icon(self):%0A        under_test = TrayIcon(TestTrayIcon.icon, TestTrayIcon.config)%0A%0A        self.assertIsNotNone(under_test.config)%0A        self.assertIsInstance(under_test.menu, QMenu)%0A%0A    def test_host_actions(self):%0A        under_test = TrayIcon(TestTrayIcon.icon, TestTrayIcon.config)%0A%0A        self.assertFalse(under_test.hosts_actions)%0A%0A        under_test.create_hosts_actions()%0A%0A        self.assertTrue(under_test.hosts_actions)

Add test for Tray_icon