def test_nix_paths(self): if platform.system().lower() == "windows": self.skipTest( "Windows platform found. not running *nix path_join tests") for idx, (parts, expected) in enumerate(self.NIX_PATHS): path = path_join(*parts) self.assertEqual('{0}: {1}'.format(idx, path), '{0}: {1}'.format(idx, expected))
def test_windows_paths(self): if platform.system().lower() != "windows": self.skipTest( 'Non windows platform found. not running non patched os.path ' 'path_join tests') for idx, (parts, expected) in enumerate(self.WIN_PATHS): path = path_join(*parts) self.assertEqual('{0}: {1}'.format(idx, path), '{0}: {1}'.format(idx, expected))
def test_nix_paths(self): if platform.system().lower() == "windows": self.skipTest( "Windows platform found. not running *nix path_join tests" ) for idx, (parts, expected) in enumerate(self.NIX_PATHS): path = path_join(*parts) self.assertEqual( '{0}: {1}'.format(idx, path), '{0}: {1}'.format(idx, expected) )
def test_windows_paths(self): if platform.system().lower() != "windows": self.skipTest( "Non windows platform found. not running non patched os.path path_join tests" ) for idx, (parts, expected) in enumerate(self.WIN_PATHS): path = path_join(*parts) self.assertEqual( '{0}: {1}'.format(idx, path), '{0}: {1}'.format(idx, expected) )
def test_mixed_unicode_and_binary(self): ''' This tests joining paths that contain a mix of components with unicode strings and non-unicode strings with the unicode characters as binary. This is no longer something we need to concern ourselves with in Python 3, but the test should nonetheless pass on Python 3. Really what we're testing here is that we don't get a UnicodeDecodeError when running on Python 2. ''' a = u'/foo/bar' b = 'Д' expected = u'/foo/bar/\u0414' actual = path_join(a, b) self.assertEqual(actual, expected)
def test_windows_paths_patched_path_module(self): if platform.system().lower() == "windows": self.skipTest( "Windows platform found. not running patched os.path path_join tests" ) self.__patch_path() for idx, (parts, expected) in enumerate(self.WIN_PATHS): path = path_join(*parts) self.assertEqual( '{0}: {1}'.format(idx, path), '{0}: {1}'.format(idx, expected) ) self.__unpatch_path()
def test_windows_paths_patched_path_module(self): if platform.system().lower() == "windows": self.skipTest( 'Windows platform found. not running patched os.path ' 'path_join tests' ) self.__patch_path() for idx, (parts, expected) in enumerate(self.WIN_PATHS): path = path_join(*parts) self.assertEqual( '{0}: {1}'.format(idx, path), '{0}: {1}'.format(idx, expected) ) self.__unpatch_path()
def test_path_join(self, is_windows_mock): self.assertFalse(is_windows_mock.return_value) expected_path = '/a/b/c/d' ret = utils.path_join('/a/b/c', 'd') self.assertEqual(ret, expected_path)
def test_path_join(self, is_windows_mock): self.assertFalse(is_windows_mock.return_value) expected_path = "/a/b/c/d" ret = utils.path_join("/a/b/c", "d") self.assertEqual(ret, expected_path)
def test_path_join(self): with patch('salt.utils.is_windows', return_value=False) as is_windows_mock: self.assertFalse(is_windows_mock.return_value) expected_path = '/a/b/c/d' ret = utils.path_join('/a/b/c', 'd') self.assertEqual(ret, expected_path)