def make_port(self, executive=None, with_tests=False, port_name=None, **kwargs): host = MockSystemHost() if executive: host.executive = executive if with_tests: add_unit_tests_to_mock_filesystem(host.filesystem) return TestPort(host, **kwargs) return Port(host, port_name or 'baseport', **kwargs)
def assert_version_properties(self, port_name, os_version, expected_name, expected_version, driver_file_output=None): host = MockSystemHost(os_name=self.os_name, os_version=(os_version or self.os_version)) host.filesystem.isfile = lambda x: 'content_shell' in x if driver_file_output: host.executive = MockExecutive(driver_file_output) port = self.make_port(host=host, port_name=port_name, os_version=os_version) self.assertEqual(port.name(), expected_name) self.assertEqual(port.version(), expected_version)