Example #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_creator.MainDialog()
     self.assertEqual(defaults.version_take_name,
                      dialog.takes_listWidget.currentItem().text())
Example #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_creator.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)
Example #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_creator.MainDialog()
        # self.show_dialog(dialog)

        self.assertEqual(defaults.version_take_name,
                         dialog.takes_listWidget.currentItem().text())
Example #4
0
    def version_creator(cls, **args):
        """version creator
        """
        # from anima.ui.scripts import fusion
        # fusion.version_creator(*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_creator

        ui_instance = version_creator.MainDialog(environment=fusion_env,
                                                 **args)
        ui_instance.show()
        ui_instance.center_window()
Example #5
0
 def test_tasks_treeView_do_not_cause_a_segfault(self):
     """there was a bug causing a segfault
     """
     dialog = version_creator.MainDialog()
     dialog = version_creator.MainDialog()
     dialog = version_creator.MainDialog()
Example #6
0
    def setUpClass(cls):
        """setup once
        """
        # remove the transaction manager
        db.DBSession.remove()

        cls.repo_path = tempfile.mkdtemp()

        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')
        db.DBSession.add(cls.power_users_group)
        db.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(
            name='Project Statuses',
            statuses=[cls.status_new, cls.status_wip, cls.status_cmpl],
            target_entity_type=Project)

        # 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='******')
        db.DBSession.add(cls.test_user1)
        db.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
        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
        ])
        db.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')
        db.DBSession.add(cls.test_version1)
        db.DBSession.commit()

        cls.test_version2 = Version(cls.test_task1,
                                    created_by=cls.admin,
                                    created_with='Test',
                                    description='Test Description')
        db.DBSession.add(cls.test_version2)
        db.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
        db.DBSession.add(cls.test_version3)
        db.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
        db.DBSession.add(cls.test_version4)
        db.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_creator.MainDialog()