def testWinSplitPathspec(self): # pylint: disable=g-import-not-at-top from grr_response_client import client_utils_windows # pylint: enable=g-import-not-at-top raw_pathspec, path = client_utils_windows.GetRawDevice("C:\\") self.assertStartsWith(raw_pathspec.path, "\\\\?\\Volume{") self.assertEqual("/", path)
def testWinSplitPathspec(self): """Test windows split pathspec functionality.""" self.SetupWinEnvironment() # We need to import after SetupWinEnvironment or this will fail # pylint: disable=g-import-not-at-top from grr_response_client import client_utils_windows # pylint: enable=g-import-not-at-top testdata = [(r"C:\Windows", "\\\\?\\Volume{11111}", "/Windows"), (r"C:\\Windows\\", "\\\\?\\Volume{11111}", "/Windows"), (r"C:\\", "\\\\?\\Volume{11111}", "/")] for filename, expected_device, expected_path in testdata: raw_pathspec, path = client_utils_windows.GetRawDevice(filename) # Pathspec paths are always absolute and therefore must have a leading /. self.assertEqual(expected_device, raw_pathspec.path) self.assertEqual(expected_path, path)