Example #1
0
    def test_is_filters_out_functions_calls_from_external_modules(self):
        # Arrange
        call_handler = Mock()
        base_path = '/path/to/base/program.py'
        modules_filter = ProjectModules(base_path, call_handler)
        frame_digest = MagicMock()
        frame_digest.file_name = '/path/to/site-packages/and/external/module.py'

        # Act
        return_value = modules_filter.on_call(frame_digest)

        # Assert
        assert_false(return_value)
        assert_equal(call_handler.on_call.call_count, 0)
Example #2
0
    def test_it_proxies_function_calls_from_project_modules(self):
        # Arrange
        call_handler = Mock()
        base_path = '/path/to/base'
        modules_filter = ProjectModules(base_path, call_handler)
        frame_digest = MagicMock()
        frame_digest.file_name = '/path/to/base/and/some/module.py'

        # Act
        return_value = modules_filter.on_call(frame_digest)

        # Assert
        assert_true(return_value)
        call_handler.on_call.assert_called_once_with(frame_digest)