# Path: tests/common.py
# class MHTestSuite(unittest.TestSuite):
#     def setUpSuite(self):
#     def tearDownSuite(self):
#     def run(self, result):
# def skip_unless_has_mod(module, submodule):
# def get_test_id(size=4):
# def random_string(size=5):
# def temp_file(name=None):
# def make_tmp_file(text=None, tdir=None):
# def get_conf_file():
# def get_orig_settings():
# def get_settings(conf=None):
# def get_types_by_string():
# def get_types_by_id():
# def get_pushover_api():
# def get_pushbullet_api():
# def get_google_api():
# def remove_file(file_path):
# 
# Path: tests/common.py
# class MHTestSuite(unittest.TestSuite):
# 
#     def setUpSuite(self):
#         # Back up current config
#         curr_config = get_conf_file()
#         backup = '{0}.orig'.format(curr_config)
#         if not os.path.exists(backup):
#             shutil.move(curr_config, backup)
#         # Make new config for testing
#         Config.make_config()
# 
#     def tearDownSuite(self):
#         # Restore original config
#         curr_config = get_conf_file()
#         backup = '{0}.orig'.format(curr_config)
#         if os.path.exists(backup):
#             shutil.move(backup, curr_config)
# 
#     def run(self, result):
#         # Before tests
#         self.setUpSuite()
#         # Set buffering
#         result.buffer = True
#         # Run tests
#         super(MHTestSuite, self).run(result)
#         # After tests
#         self.tearDownSuite()


import responses
import tests.common as common
import mediahandler.util.notify as Notify
from tests.common import unittest
from tests.common import MHTestSuite
                      f'{_api_endpoint_2}/messages.json',
                      json={'status': 1},
                      status=200)
        # Enable push
        self.push.disable = False
        self.push.notify_name = 'test'
        # Generate a 2nd name
        skips = "skip-{0}".format(common.get_test_id())
        # Set up test
        file_array = [self.name]
        skipped = [skips]
        # Run test
        result = self.push.success(file_array, skipped)
        reg1 = r'\+ {0}'.format(
            self.name)
        reg2 = r'Skipped files:\n\- {0}'.format(skips)
        regex = r'{0}\n\n{1}'.format(reg1, reg2)
        self.assertRegexpMatches(result, regex)

    def test_failure_normal(self):
        # Enable push
        self.push.disable = False
        # Set up test
        msg = common.random_string(10)
        # Run test
        self.assertRaisesRegexp(
            SystemExit, msg, self.push.failure, msg)


def suite():

# Path: tests/common.py
# class MHTestSuite(unittest.TestSuite):
#     def setUpSuite(self):
#     def tearDownSuite(self):
#     def run(self, result):
# def skip_unless_has_mod(module, submodule):
# def get_test_id(size=4):
# def random_string(size=5):
# def temp_file(name=None):
# def make_tmp_file(text=None, tdir=None):
# def get_conf_file():
# def get_orig_settings():
# def get_settings(conf=None):
# def get_types_by_string():
# def get_types_by_id():
# def get_pushover_api():
# def get_pushbullet_api():
# def get_google_api():
# def remove_file(file_path):
# 
# Path: tests/common.py
# class MHTestSuite(unittest.TestSuite):
# 
#     def setUpSuite(self):
#         # Back up current config
#         curr_config = get_conf_file()
#         backup = '{0}.orig'.format(curr_config)
#         if not os.path.exists(backup):
#             shutil.move(curr_config, backup)
#         # Make new config for testing
#         Config.make_config()
# 
#     def tearDownSuite(self):
#         # Restore original config
#         curr_config = get_conf_file()
#         backup = '{0}.orig'.format(curr_config)
#         if os.path.exists(backup):
#             shutil.move(backup, curr_config)
# 
#     def run(self, result):
#         # Before tests
#         self.setUpSuite()
#         # Set buffering
#         result.buffer = True
#         # Run tests
#         super(MHTestSuite, self).run(result)
#         # After tests
#         self.tearDownSuite()


# Path: tests/test_notify.py
import responses
import tests.common as common
import mediahandler.util.notify as Notify
from tests.common import unittest
from tests.common import MHTestSuite

                      f'{_api_endpoint_2}/messages.json',
                      json={'status': 1},
                      status=200)
        # Enable push
        self.push.disable = False
        self.push.notify_name = 'test'
        # Generate a 2nd name
        skips = "skip-{0}".format(common.get_test_id())
        # Set up test
        file_array = [self.name]
        skipped = [skips]
        # Run test
        result = self.push.success(file_array, skipped)
        reg1 = r'\+ {0}'.format(
            self.name)
        reg2 = r'Skipped files:\n\- {0}'.format(skips)
        regex = r'{0}\n\n{1}'.format(reg1, reg2)
        self.assertRegexpMatches(result, regex)

    def test_failure_normal(self):
        # Enable push
        self.push.disable = False
        # Set up test
        msg = common.random_string(10)
        # Run test
        self.assertRaisesRegexp(
            SystemExit, msg, self.push.failure, msg)


def suite():

    s = MHTestSuite()