def __init__(self, log_executive=False, os_name=None, os_version=None, executive=None, filesystem=None, time_return_val=123): self.executable = 'python' self.executive = executive or MockExecutive(should_log=log_executive) self.filesystem = filesystem or MockFileSystem() self.user = MockUser() self.platform = MockPlatformInfo() if os_name: self.platform.os_name = os_name if os_version: self.platform.os_version = os_version # FIXME: Should this take pointers to the filesystem and the executive? self.workspace = MockWorkspace() self.stdin = StringIO() self.stdout = StringIO() self.stderr = StringIO() self.environ = { 'MOCK_ENVIRON_COPY': '1', 'PATH': '/bin:/mock/bin' } self.time_return_val = time_return_val
def _assert_config_file_for_linux_distribution(self, port, distribution, config_file): port.host.platform = MockPlatformInfo(os_name='linux', linux_distribution=distribution) self.assertEqual(port._apache_config_file_name_for_platform(), config_file) # pylint: disable=protected-access
def _assert_config_file_for_platform(self, port, platform, config_file): port.host.platform = MockPlatformInfo(os_name=platform) self.assertEqual(port._apache_config_file_name_for_platform(), config_file) # pylint: disable=protected-access
def test_abspath_to_uri_escaping_unixy(self): self.assertEqual(path.abspath_to_uri(MockPlatformInfo(), '/foo/bar + baz%?.html'), 'file:///foo/bar%20+%20baz%25%3F.html')
def test_abspath_to_uri_unixy(self): self.assertEqual(path.abspath_to_uri(MockPlatformInfo(), '/foo/bar.html'), 'file:///foo/bar.html')
def _assert_default_profiler_name(self, os_name, expected_profiler_name): profiler_name = ProfilerFactory.default_profiler_name( MockPlatformInfo(os_name)) self.assertEqual(profiler_name, expected_profiler_name)