示例#1
0
    def test_get_local_file(self):
        fm = resource.TestResourceManager(
            resource.LocalResourceManagerBackend()).create_session()
        self.assertEqual(self.local_file, fm.get_file(test_file_name))
        self.assertEqual(self.local_file, resource.get_file(test_file_name))

        paths = []
        for it in os.listdir(self.local_dir):
            paths.append(smart_text(os.path.join(self.local_dir, it)))
        self.assertEqual(paths, fm.list_dir(''))
        self.assertEqual(paths, resource.list_dir(''))
示例#2
0
 def test_list_dir(self):
     _, _, res_dir = _create_testfile()
     self.addCleanup(_rm_testfile)
     fm = resource.TestResourceManager(
         resource.LocalResourceManagerBackend()).create_session()
     paths = []
     from testbase.util import _to_unicode
     for it in os.listdir(res_dir):
         paths.append(_to_unicode(os.path.join(res_dir, it)))
     self.assertEqual(paths, fm.list_dir(''))
     self.assertEqual(paths, resource.list_dir(''))
示例#3
0
    def test_get_local_file(self):
        fm = resource.TestResourceManager(resource.LocalResourceManagerBackend()).create_session()
        self.assertEqual(self.local_file, fm.get_file(test_file_name))
        self.assertEqual(self.local_file, resource.get_file(test_file_name))

        paths = os.listdir(os.path.join(self.local_dir, test_dir_name))
        for i, path in enumerate(paths):
            if path.endswith(".link"):
                paths[i] = path[:-5]
        list_result = fm.list_dir(test_dir_name)
        self.assertEqual(paths, list_result)
        list_result = resource.list_dir(test_dir_name)
        self.assertEqual(paths, list_result)