Exemple #1
0
 def test_takes_listWidget_lists_Main_by_default(self):
     """testing if the takes_listWidget lists "Main" by default
     """
     from anima import defaults
     dialog = version_dialog.MainDialog()
     self.assertEqual(defaults.version_take_name,
                      dialog.takes_list_widget.currentItem().text())
Exemple #2
0
 def test_representations_combo_box_lists_all_representations_of_current_env(
         self):
     """testing if representations_comboBox lists all the possible
     representations in current environment
     """
     test_environment = TestEnvironment()
     dialog = version_dialog.MainDialog(environment=test_environment)
     for i in range(len(TestEnvironment.representations)):
         repr_name = TestEnvironment.representations[i]
         combo_box_text = dialog.representations_comboBox.itemText(i)
         self.assertEqual(repr_name, combo_box_text)
Exemple #3
0
    def test_takes_listWidget_lists_Main_by_default_for_projects_with_no_tasks(
            self):
        """testing if the takes_listWidget lists "Main" by default for a
        project with no tasks
        """
        # now call the dialog and expect to see all these projects as root
        # level items in tasks_treeView

        dialog = version_dialog.MainDialog()
        # self.show_dialog(dialog)

        from anima import defaults
        self.assertEqual(defaults.version_take_name,
                         dialog.takes_list_widget.currentItem().text())
Exemple #4
0
    def version_dialog(cls, **args):
        """version dialog
        """
        # from anima.ui.scripts import fusion
        # fusion.version_dialog(*args)
        from anima.utils import do_db_setup
        do_db_setup()
        from anima.env import fusion
        fusion_env = fusion.Fusion()
        fusion_env.name = 'Fusion'

        from anima.ui import version_dialog

        ui_instance = version_dialog.MainDialog(
            environment=fusion_env,
            **args
        )
        ui_instance.show()
        ui_instance.center_window()
Exemple #5
0
    def setUpClass(cls):
        """setup once
        """
        # remove the transaction manager
        DBSession.remove()

        cls.repo_path = tempfile.mkdtemp()

        from anima import defaults
        defaults.local_storage_path = tempfile.mktemp()

        db.setup({
            'sqlalchemy.url': 'sqlite:///:memory:',
            'sqlalchemy.echo': 'false'
        })
        db.init()

        # create Power Users Group
        cls.power_users_group = Group(name='Power Users')
        DBSession.add(cls.power_users_group)
        DBSession.commit()

        # create a LocalSession first
        cls.admin = User.query.all()[0]
        cls.lsession = LocalSession()
        cls.lsession.store_user(cls.admin)
        cls.lsession.save()

        # create a repository
        cls.test_repo1 = Repository(name='Test Repository',
                                    windows_path='T:/TestRepo/',
                                    linux_path='/mnt/T/TestRepo/',
                                    osx_path='/Volumes/T/TestRepo/')

        cls.test_structure1 = Structure(name='Test Project Structure',
                                        templates=[],
                                        custom_template='')

        cls.status_new = Status.query.filter_by(code='NEW').first()
        cls.status_wip = Status.query.filter_by(code='WIP').first()
        cls.status_cmpl = Status.query.filter_by(code='CMPL').first()

        cls.project_status_list = \
            StatusList.query.filter_by(target_entity_type=Project).first()

        # create a couple of projects
        cls.test_project1 = Project(name='Project 1',
                                    code='P1',
                                    repository=cls.test_repo1,
                                    structure=cls.test_structure1,
                                    status_list=cls.project_status_list)

        cls.test_project2 = Project(name='Project 2',
                                    code='P2',
                                    repository=cls.test_repo1,
                                    structure=cls.test_structure1,
                                    status_list=cls.project_status_list)

        cls.test_project3 = Project(name='Project 3',
                                    code='P3',
                                    repository=cls.test_repo1,
                                    structure=cls.test_structure1,
                                    status_list=cls.project_status_list)

        cls.projects = [
            cls.test_project1, cls.test_project2, cls.test_project3
        ]

        cls.test_user1 = User(
            name='Test User',
            # groups=[self.power_users_group],
            login='******',
            email='*****@*****.**',
            password='******')
        DBSession.add(cls.test_user1)
        DBSession.commit()

        cls.admin.projects.append(cls.test_project1)
        cls.admin.projects.append(cls.test_project2)
        cls.admin.projects.append(cls.test_project3)
        cls.test_user1.projects.append(cls.test_project1)
        cls.test_user1.projects.append(cls.test_project2)
        cls.test_user1.projects.append(cls.test_project3)

        # project 1
        cls.test_task1 = Task(
            name='Test Task 1',
            project=cls.test_project1,
            resources=[cls.admin],
        )

        cls.test_task2 = Task(
            name='Test Task 2',
            project=cls.test_project1,
            resources=[cls.admin],
        )

        cls.test_task3 = Task(
            name='Test Task 2',
            project=cls.test_project1,
            resources=[cls.admin],
        )

        # project 2
        cls.test_task4 = Task(
            name='Test Task 4',
            project=cls.test_project2,
            resources=[cls.admin],
        )

        cls.test_task5 = Task(
            name='Test Task 5',
            project=cls.test_project2,
            resources=[cls.admin],
        )

        cls.test_task6 = Task(
            name='Test Task 6',
            parent=cls.test_task5,
            resources=[cls.admin],
        )

        cls.test_task7 = Task(
            name='Test Task 7',
            parent=cls.test_task5,
            resources=[],
        )

        cls.test_task8 = Task(
            name='Test Task 8',
            parent=cls.test_task5,
            resources=[],
        )

        cls.test_task9 = Task(
            name='Test Task 9',
            parent=cls.test_task5,
            resources=[],
        )

        # +-> Project 1
        # | |
        # | +-> Task1
        # | |
        # | +-> Task2
        # | |
        # | +-> Task3
        # |
        # +-> Project 2
        # | |
        # | +-> Task4
        # | |
        # | +-> Task5
        # |   |
        # |   +-> Task6
        # |   |
        # |   +-> Task7 (no resource)
        # |   |
        # |   +-> Task8 (no resource)
        # |   |
        # |   +-> Task9 (no resource)
        # |
        # +-> Project 3

        # record them all to the db
        DBSession.add_all([
            cls.admin, cls.test_project1, cls.test_project2, cls.test_project3,
            cls.test_task1, cls.test_task2, cls.test_task3, cls.test_task4,
            cls.test_task5, cls.test_task6, cls.test_task7, cls.test_task8,
            cls.test_task9
        ])
        DBSession.commit()

        cls.all_tasks = [
            cls.test_task1, cls.test_task2, cls.test_task3, cls.test_task4,
            cls.test_task5, cls.test_task6, cls.test_task7, cls.test_task8,
            cls.test_task9
        ]

        # create versions
        cls.test_version1 = Version(cls.test_task1,
                                    created_by=cls.admin,
                                    created_with='Test',
                                    description='Test Description')
        DBSession.add(cls.test_version1)
        DBSession.commit()

        cls.test_version2 = Version(cls.test_task1,
                                    created_by=cls.admin,
                                    created_with='Test',
                                    description='Test Description')
        DBSession.add(cls.test_version2)
        DBSession.commit()

        cls.test_version3 = Version(cls.test_task1,
                                    created_by=cls.admin,
                                    created_with='Test',
                                    description='Test Description')
        cls.test_version3.is_published = True
        DBSession.add(cls.test_version3)
        DBSession.commit()

        cls.test_version4 = Version(cls.test_task1,
                                    take_name='Main@GPU',
                                    created_by=cls.admin,
                                    created_with='Test',
                                    description='Test Description')
        cls.test_version4.is_published = True
        DBSession.add(cls.test_version4)
        DBSession.commit()

        if not QtGui.QApplication.instance():
            logger.debug('creating a new QApplication')
            cls.app = QtGui.QApplication(sys.argv)
        else:
            logger.debug('using the present QApplication: %s' % QtGui.qApp)
            # self.app = QtGui.qApp
            cls.app = QtGui.QApplication.instance()

        # cls.test_environment = TestEnvironment()
        cls.dialog = version_dialog.MainDialog()
Exemple #6
0
 def test_tasks_treeView_do_not_cause_a_segfault(self):
     """there was a bug causing a segfault
     """
     dialog = version_dialog.MainDialog()
     dialog = version_dialog.MainDialog()
     dialog = version_dialog.MainDialog()