コード例 #1
0
 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))
コード例 #2
0
    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))
コード例 #3
0
ファイル: path_join_test.py プロジェクト: sijis/salt
 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)
         )
コード例 #4
0
ファイル: path_join_test.py プロジェクト: nkhuyu/salt
    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)
            )
コード例 #5
0
    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)
コード例 #6
0
ファイル: path_join_test.py プロジェクト: bryson/salt
    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)
コード例 #7
0
ファイル: path_join_test.py プロジェクト: nkhuyu/salt
    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()
コード例 #8
0
ファイル: path_join_test.py プロジェクト: sijis/salt
    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()
コード例 #9
0
ファイル: utils_test.py プロジェクト: Roche/salt
 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)
コード例 #10
0
ファイル: utils_test.py プロジェクト: penta-srl/salt
 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)
コード例 #11
0
ファイル: utils_test.py プロジェクト: bemehow/salt
 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)
コード例 #12
0
 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)