# Path: alignak_app/utils/config.py
# class Settings(object):
#     def __init__(self):
#     def init_config(self):
#     def get_config(self, section, option, boolean=False):
#     def set_config(self, section, option, new_value):
#     def get_image(self, name):
#     def init_css(self):
# def open_url(endpoint='login'):  # pragma: no cover
# def get_url_endpoint_from_icon_name(icon_name):
# 
# Path: alignak_app/qobjects/common/buttons.py
# class ToggleQWidgetButton(QWidget):
#     """
#         Class who create QWidget with "toggle" QPushButton inside.
#     """
# 
#     def __init__(self, parent=None):
#         super(ToggleQWidgetButton, self).__init__(parent)
#         self.toggle_btn = QPushButton()
# 
#     def initialize(self):
#         """
#         Initialize QWidget
# 
#         """
# 
#         layout = QHBoxLayout()
#         layout.setContentsMargins(0, 0, 0, 0)
#         self.setLayout(layout)
# 
#         self.toggle_btn.setText(_('ON'))
#         self.toggle_btn.setFixedSize(80, 20)
#         self.toggle_btn.setCheckable(True)
#         self.toggle_btn.setChecked(True)
#         self.toggle_btn.setObjectName('True')
#         self.toggle_btn.clicked.connect(self.update_btn_state)
#         layout.addWidget(self.toggle_btn)
# 
#     def update_btn_state(self, state):
#         """
#         Update QPushButton state, ObjectName and StyleSheet
# 
#         :param state: current state of QPushButton
#         :type state: bool
#         """
# 
#         states = {
#             True: "ON",
#             False: "OFF"
#         }
# 
#         self.toggle_btn.setChecked(state)
#         self.toggle_btn.setText(states[state])
#         self.toggle_btn.setObjectName(str(state))
#         self.toggle_btn.setStyleSheet(settings.css_style)
# 
#     def is_checked(self):
#         """
#         Return "toggle_btn" state
# 
#         :return: QPushButton state
#         :rtype: bool
#         """
# 
#         return self.toggle_btn.isChecked()


import sys
import unittest2
from PyQt5.Qt import QApplication, QWidget, QPushButton
from alignak_app.utils.config import settings
from alignak_app.qobjects.common.buttons import ToggleQWidgetButton
    """

    @classmethod
    def setUpClass(cls):
        """Create QApplication"""
        try:
            cls.app = QApplication(sys.argv)
        except:
            pass

    def test_toggle_button_init(self):
        """Initialize ToggleQWidgetButton"""

        under_test = ToggleQWidgetButton()

        self.assertIsInstance(under_test, QWidget)
        self.assertIsInstance(under_test.toggle_btn, QPushButton)
        self.assertFalse(under_test.toggle_btn.isChecked())
        self.assertEqual('', under_test.toggle_btn.text())

        under_test.initialize()

        self.assertIsInstance(under_test, QWidget)
        self.assertIsInstance(under_test.toggle_btn, QPushButton)
        self.assertTrue(under_test.toggle_btn.isChecked())
        self.assertEqual('ON', under_test.toggle_btn.text())

    def test_update_btn_state(self):
        """Update ToggleQWidgetButton state"""


# Path: alignak_app/utils/config.py
# class Settings(object):
#     def __init__(self):
#     def init_config(self):
#     def get_config(self, section, option, boolean=False):
#     def set_config(self, section, option, new_value):
#     def get_image(self, name):
#     def init_css(self):
# def open_url(endpoint='login'):  # pragma: no cover
# def get_url_endpoint_from_icon_name(icon_name):
# 
# Path: alignak_app/qobjects/common/buttons.py
# class ToggleQWidgetButton(QWidget):
#     """
#         Class who create QWidget with "toggle" QPushButton inside.
#     """
# 
#     def __init__(self, parent=None):
#         super(ToggleQWidgetButton, self).__init__(parent)
#         self.toggle_btn = QPushButton()
# 
#     def initialize(self):
#         """
#         Initialize QWidget
# 
#         """
# 
#         layout = QHBoxLayout()
#         layout.setContentsMargins(0, 0, 0, 0)
#         self.setLayout(layout)
# 
#         self.toggle_btn.setText(_('ON'))
#         self.toggle_btn.setFixedSize(80, 20)
#         self.toggle_btn.setCheckable(True)
#         self.toggle_btn.setChecked(True)
#         self.toggle_btn.setObjectName('True')
#         self.toggle_btn.clicked.connect(self.update_btn_state)
#         layout.addWidget(self.toggle_btn)
# 
#     def update_btn_state(self, state):
#         """
#         Update QPushButton state, ObjectName and StyleSheet
# 
#         :param state: current state of QPushButton
#         :type state: bool
#         """
# 
#         states = {
#             True: "ON",
#             False: "OFF"
#         }
# 
#         self.toggle_btn.setChecked(state)
#         self.toggle_btn.setText(states[state])
#         self.toggle_btn.setObjectName(str(state))
#         self.toggle_btn.setStyleSheet(settings.css_style)
# 
#     def is_checked(self):
#         """
#         Return "toggle_btn" state
# 
#         :return: QPushButton state
#         :rtype: bool
#         """
# 
#         return self.toggle_btn.isChecked()


# Path: test/test_common_buttons.py
import sys
import unittest2
from PyQt5.Qt import QApplication, QWidget, QPushButton
from alignak_app.utils.config import settings
from alignak_app.qobjects.common.buttons import ToggleQWidgetButton

    """

    @classmethod
    def setUpClass(cls):
        """Create QApplication"""
        try:
            cls.app = QApplication(sys.argv)
        except:
            pass

    def test_toggle_button_init(self):
        """Initialize ToggleQWidgetButton"""

        under_test = ToggleQWidgetButton()

        self.assertIsInstance(under_test, QWidget)
        self.assertIsInstance(under_test.toggle_btn, QPushButton)
        self.assertFalse(under_test.toggle_btn.isChecked())
        self.assertEqual('', under_test.toggle_btn.text())

        under_test.initialize()

        self.assertIsInstance(under_test, QWidget)
        self.assertIsInstance(under_test.toggle_btn, QPushButton)
        self.assertTrue(under_test.toggle_btn.isChecked())
        self.assertEqual('ON', under_test.toggle_btn.text())

    def test_update_btn_state(self):
        """Update ToggleQWidgetButton state"""


        under_test = ToggleQWidgetButton()