コード例 #1
0
    def test_run_in_catbox(self):
        with mock.patch('testify.plugins.violation_collector.catbox') as mock_catbox:
            mock_method = mock.Mock()
            mock_logger = mock.Mock()
            mock_paths = mock.Mock()

            run_in_catbox(mock_method, mock_logger, mock_paths)

            mock_catbox.run.assert_called_with(
                mock_method,
                collect_only=True,
                network=False,
                logger=mock_logger,
                writable_paths=mock_paths,
            )
コード例 #2
0
    def test_run_in_catbox(self):
        with mock.patch(
                'testify.plugins.violation_collector.catbox') as mock_catbox:
            mock_method = mock.Mock()
            mock_logger = mock.Mock()
            mock_paths = mock.Mock()

            run_in_catbox(mock_method, mock_logger, mock_paths)

            mock_catbox.run.assert_called_with(
                mock_method,
                collect_only=True,
                network=False,
                logger=mock_logger,
                writable_paths=mock_paths,
            )
コード例 #3
0
    def run_testcase_in_catbox(self, test_case):
        if not catbox:
            msg = 'Violation collection pipeline tests require catbox.\n'
            msg_pcre = 'https://github.com/Yelp/catbox/wiki/Install-Catbox-with-PCRE-enabled\n'
            raise ImportError, msg + msg_pcre

        with sqlite_store() as store:
            with mocked_reporter(store) as reporter:
                ctx.store = store

                # Runing the test case inside catbox, we'll catch
                # violating syscalls and catbox will call our logger
                # function (collect)
                runner = T.test_runner.TestRunner(test_case, test_reporters=[reporter])
                run_in_catbox(runner.run, collect, [])

                yield store.violation_counts()

                ctx.store = None
コード例 #4
0
    def run_testcase_in_catbox(self, test_case):
        if not catbox:
            msg = 'Violation collection pipeline tests require catbox.\n'
            msg_pcre = 'https://github.com/Yelp/catbox/wiki/Install-Catbox-with-PCRE-enabled\n'
            raise ImportError, msg + msg_pcre

        with sqlite_store() as store:
            with mocked_reporter(store) as reporter:
                ctx.store = store

                # Runing the test case inside catbox, we'll catch
                # violating syscalls and catbox will call our logger
                # function (collect)
                runner = T.test_runner.TestRunner(test_case,
                                                  test_reporters=[reporter])
                run_in_catbox(runner.run, collect, [])

                yield store.violation_counts()

                ctx.store = None