Exemplo n.º 1
0
    def setUp(self):
        self.core = PopulateCore()
        self.client_filesystem = ClientFileSystem()
        self.client_filesystem.client = self.core.dummy_client

        self.project_filesystem = ProjectFileSystem()
        self.project_filesystem.project = self.core.dummy_project
Exemplo n.º 2
0
class TestProjectFileSystem(TestCase):
    def setUp(self):
        self.core = PopulateCore()

        self.client_filesystem = ClientFileSystem()
        self.client_filesystem.client = self.core.dummy_client

        self.project_filesystem = ProjectFileSystem()
        self.project_filesystem.project = self.core.dummy_project

    def tearDown(self):
        shutil.rmtree(settings.STORAGE_ROOT)
        os.makedirs(settings.STORAGE_ROOT)

    def test_project_filesystem(self):
        client_root = self.client_filesystem.create_filesystem()
        expected_project_root = self.project_filesystem.create_filesystem()

        project_root = os.path.join(client_root, settings.PROJECTS_ROOT, self.core.dummy_project.short_code)
        self.assertEqual(project_root, expected_project_root)

        symlinks_dirs = glob(os.path.join(client_root, '*-links'))
        for check_dir in symlinks_dirs:
            link = glob(os.path.join(check_dir, '*'))[0]
            self.assertTrue(os.path.islink(link))
            self.assertEqual(os.path.basename(link), self.project_filesystem.project_dir_name)
            dir_type = os.path.basename(check_dir).split('-')[0]
            dir_target = getattr(self.project_filesystem, dir_type + '_path')
            self.assertEqual(os.path.realpath(link), dir_target)
Exemplo n.º 3
0
class TestClientFileSystem(TestCase):
    def setUp(self):
        self.core = PopulateCore()
        self.client_filesystem = ClientFileSystem()
        self.client_filesystem.client = self.core.dummy_client

        self.project_filesystem = ProjectFileSystem()
        self.project_filesystem.project = self.core.dummy_project

    def tearDown(self):
        shutil.rmtree(settings.STORAGE_ROOT)
        os.makedirs(settings.STORAGE_ROOT)

    def test_client_filesystem(self):
        client_root = self.client_filesystem.create_filesystem()
        self.assertEqual(client_root, os.path.join(settings.STORAGE_ROOT, self.core.dummy_client.name))
        test_dirs = pick_values_by_key(self.client_filesystem, "_path")
        for test_dir in test_dirs:
            self.assertTrue(os.path.isdir(test_dir))