Example #1
0
 def setUp(self):
     self.options = {
         'exporter_options': {
             'LOG_LEVEL': 'DEBUG',
             'LOGGER_NAME': 'export-pipeline'
         },
         'options': {}
     }
     self.notifier = BaseNotifier(self.options, {})
Example #2
0
    def test_check_not_required_supported_option(self):
        options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {}
        }

        test_notifier = BaseNotifier(options, {})
        test_notifier.supported_options['test'] = {'type': int, 'default': 5}
        test_notifier.check_options()
 def test_check_bad_type_required_supported_option(self):
     options = {
         'exporter_options': {
             'LOG_LEVEL': 'DEBUG',
             'LOGGER_NAME': 'export-pipeline'
         },
         'options': {
             "test": 100
         }
     }
     with self.assertRaises(Exception):
         test_notifier = BaseNotifier(options)
         test_notifier.supported_options.append({'name': 'test', 'type': basestring})
         test_notifier.check_options()
    def test_check_not_required_supported_option(self):
        options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {

            }
        }

        test_notifier = BaseNotifier(options, {})
        test_notifier.supported_options['test'] = {'type': int, 'default': 5}
        test_notifier.check_options()
Example #5
0
 def test_check_bad_type_required_supported_option(self):
     options = {
         'exporter_options': {
             'LOG_LEVEL': 'DEBUG',
             'LOGGER_NAME': 'export-pipeline'
         },
         'options': {
             "test": 100
         }
     }
     with self.assertRaises(Exception):
         test_notifier = BaseNotifier(options)
         test_notifier.supported_options.append({
             'name': 'test',
             'type': basestring
         })
         test_notifier.check_options()
    def setUp(self):
        self.options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {

            }
        }
        self.notifier = BaseNotifier(self.options, {})
class BaseNotifierTest(unittest.TestCase):

    def setUp(self):
        self.options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {

            }
        }
        self.notifier = BaseNotifier(self.options, {})

    def test_raise_exception_start_dump(self):
        with self.assertRaises(NotImplementedError):
            self.notifier.notify_start_dump([])

    def test_raise_exception_complete_dump(self):
        with self.assertRaises(NotImplementedError):
            self.notifier.notify_complete_dump([])

    def test_raise_exception_failed_job(self):
        with self.assertRaises(NotImplementedError):
            self.notifier.notify_failed_job('', '', [])

    def test_check_not_existing_required_supported_option(self):
        with self.assertRaises(Exception):
            test_notifier = self.notifier
            test_notifier.supported_options.append({'name': 'test', 'type': basestring})
            test_notifier.check_options()

    def test_check_not_required_supported_option(self):
        options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {

            }
        }

        test_notifier = BaseNotifier(options, {})
        test_notifier.supported_options['test'] = {'type': int, 'default': 5}
        test_notifier.check_options()

    def test_check_bad_type_required_supported_option(self):
        options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {
                "test": 100
            }
        }
        with self.assertRaises(Exception):
            test_notifier = BaseNotifier(options)
            test_notifier.supported_options.append({'name': 'test', 'type': basestring})
            test_notifier.check_options()
Example #8
0
class BaseNotifierTest(unittest.TestCase):
    def setUp(self):
        self.options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {}
        }
        self.notifier = BaseNotifier(self.options, {})

    def test_raise_exception_start_dump(self):
        with self.assertRaises(NotImplementedError):
            self.notifier.notify_start_dump([])

    def test_raise_exception_complete_dump(self):
        with self.assertRaises(NotImplementedError):
            self.notifier.notify_complete_dump([])

    def test_raise_exception_failed_job(self):
        with self.assertRaises(NotImplementedError):
            self.notifier.notify_failed_job('', '', [])

    def test_check_not_existing_required_supported_option(self):
        with self.assertRaises(Exception):
            test_notifier = self.notifier
            test_notifier.supported_options.append({
                'name': 'test',
                'type': basestring
            })
            test_notifier.check_options()

    def test_check_not_required_supported_option(self):
        options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {}
        }

        test_notifier = BaseNotifier(options, {})
        test_notifier.supported_options['test'] = {'type': int, 'default': 5}
        test_notifier.check_options()

    def test_check_bad_type_required_supported_option(self):
        options = {
            'exporter_options': {
                'LOG_LEVEL': 'DEBUG',
                'LOGGER_NAME': 'export-pipeline'
            },
            'options': {
                "test": 100
            }
        }
        with self.assertRaises(Exception):
            test_notifier = BaseNotifier(options)
            test_notifier.supported_options.append({
                'name': 'test',
                'type': basestring
            })
            test_notifier.check_options()