Example #1
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)
Example #2
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