# Path: ubuntucleaner/gui/dialogs.py
# class BaseDialog(Gtk.MessageDialog):
#     def __init__(self, **kwargs):
#         title = kwargs.pop('title', '')
#         message = kwargs.pop('message', '')
# 
#         GObject.GObject.__init__(self, **kwargs)
# 
#         if title:
#             self.set_title(title)
# 
#         if message:
#             self.set_content(message)
# 
#     def set_title(self, title):
#         self.set_markup('<big><b>%s</b></big>' % title)
# 
#     def set_content(self, message):
#         if self.get_property('text'):
#             self.format_secondary_markup(message)
#         else:
#             self.set_markup(message)
#     
#     def launch(self):
#         self.run()
#         self.destroy()
# 
# class ErrorDialog(BaseDialog):
#     def __init__(self, title='', message='', parent=None,
#                  type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK):
#         BaseDialog.__init__(self, title=title, message=message,
#                             parent=parent, message_type=type, buttons=buttons)
# 
# class InfoDialog(BaseDialog):
#     def __init__(self, title='', message='', parent=None,
#                  type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK):
#         BaseDialog.__init__(self, title=title, message=message,
#                             parent=parent, message_type=type, buttons=buttons)
# 
# class WarningDialog(BaseDialog):
#     def __init__(self, title='', message='', parent=None,
#                  type=Gtk.MessageType.WARNING, buttons=Gtk.ButtonsType.OK):
#         BaseDialog.__init__(self, title=title, message=message,
#                             parent=parent, message_type=type, buttons=buttons)
# 
# class QuestionDialog(BaseDialog):
#     def __init__(self, title='', message='', parent=None,
#                  type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.YES_NO):
#         BaseDialog.__init__(self, title=title, message=message,
#                             parent=parent, message_type=type, buttons=buttons)


import mock
import unittest
from gi.repository import Gtk
from ubuntucleaner.gui.dialogs import (
    BaseDialog, ErrorDialog, InfoDialog, WarningDialog, QuestionDialog)

    def test_message(self):
        init_params = {'message': 'message'}
        dialog = BaseDialog(**init_params)
        self.assertEqual(dialog.get_title(), '')
        self.assertEqual(dialog.get_property('text'), 'message')
        self.assertIsNone(dialog.get_property('secondary-text'))

    def test_title_message(self):
        init_params = {'title': 'title', 'message': 'message'}
        dialog = BaseDialog(**init_params)
        self.assertEqual(dialog.get_title(), '')
        self.assertEqual(dialog.get_property('text'), '<big><b>title</b></big>')
        self.assertEqual(dialog.get_property('secondary-text'), 'message')

    def test_launch(self):
        dialog = BaseDialog()
        with mock.patch("ubuntucleaner.gui.dialogs.BaseDialog.run") as m_run:
            dialog.launch()
        self.assertEqual(m_run.call_args_list, [mock.call()])

    def test_error_dialog(self):
        dialog = ErrorDialog()
        self.assertTrue(isinstance(dialog, BaseDialog))

    def test_info_dialog(self):
        dialog = InfoDialog()
        self.assertTrue(isinstance(dialog, BaseDialog))

    def test_warning_dialog(self):

# Path: ubuntucleaner/gui/dialogs.py
# class BaseDialog(Gtk.MessageDialog):
#     def __init__(self, **kwargs):
#         title = kwargs.pop('title', '')
#         message = kwargs.pop('message', '')
# 
#         GObject.GObject.__init__(self, **kwargs)
# 
#         if title:
#             self.set_title(title)
# 
#         if message:
#             self.set_content(message)
# 
#     def set_title(self, title):
#         self.set_markup('<big><b>%s</b></big>' % title)
# 
#     def set_content(self, message):
#         if self.get_property('text'):
#             self.format_secondary_markup(message)
#         else:
#             self.set_markup(message)
#     
#     def launch(self):
#         self.run()
#         self.destroy()
# 
# class ErrorDialog(BaseDialog):
#     def __init__(self, title='', message='', parent=None,
#                  type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK):
#         BaseDialog.__init__(self, title=title, message=message,
#                             parent=parent, message_type=type, buttons=buttons)
# 
# class InfoDialog(BaseDialog):
#     def __init__(self, title='', message='', parent=None,
#                  type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK):
#         BaseDialog.__init__(self, title=title, message=message,
#                             parent=parent, message_type=type, buttons=buttons)
# 
# class WarningDialog(BaseDialog):
#     def __init__(self, title='', message='', parent=None,
#                  type=Gtk.MessageType.WARNING, buttons=Gtk.ButtonsType.OK):
#         BaseDialog.__init__(self, title=title, message=message,
#                             parent=parent, message_type=type, buttons=buttons)
# 
# class QuestionDialog(BaseDialog):
#     def __init__(self, title='', message='', parent=None,
#                  type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.YES_NO):
#         BaseDialog.__init__(self, title=title, message=message,
#                             parent=parent, message_type=type, buttons=buttons)


# Path: tests/gui/test_dialogs.py
import mock
import unittest
from gi.repository import Gtk
from ubuntucleaner.gui.dialogs import (
    BaseDialog, ErrorDialog, InfoDialog, WarningDialog, QuestionDialog)


    def test_message(self):
        init_params = {'message': 'message'}
        dialog = BaseDialog(**init_params)
        self.assertEqual(dialog.get_title(), '')
        self.assertEqual(dialog.get_property('text'), 'message')
        self.assertIsNone(dialog.get_property('secondary-text'))

    def test_title_message(self):
        init_params = {'title': 'title', 'message': 'message'}
        dialog = BaseDialog(**init_params)
        self.assertEqual(dialog.get_title(), '')
        self.assertEqual(dialog.get_property('text'), '<big><b>title</b></big>')
        self.assertEqual(dialog.get_property('secondary-text'), 'message')

    def test_launch(self):
        dialog = BaseDialog()
        with mock.patch("ubuntucleaner.gui.dialogs.BaseDialog.run") as m_run:
            dialog.launch()
        self.assertEqual(m_run.call_args_list, [mock.call()])

    def test_error_dialog(self):
        dialog = ErrorDialog()
        self.assertTrue(isinstance(dialog, BaseDialog))

    def test_info_dialog(self):
        dialog = InfoDialog()
        self.assertTrue(isinstance(dialog, BaseDialog))

    def test_warning_dialog(self):

        dialog = WarningDialog()