コード例 #1
0
    def test_assets_tableWidget_horizontal_labels_are_set_properly(self):
        """testing if the assets_tableWidget horizontal labels are filled with
        all the possible VersionTypes for assets
        """

        db.setup()

        asset_vtypes = VersionType.query()\
            .filter(VersionType.type_for=='Asset')\
            .order_by(VersionType.name)\
            .all()

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

        self.assertEqual(
            dialog.assets_tableWidget.horizontalHeaderItem(0).text(),
            'Thumbnail')

        self.assertEqual(
            dialog.assets_tableWidget.horizontalHeaderItem(1).text(), 'Type')

        self.assertEqual(
            dialog.assets_tableWidget.horizontalHeaderItem(2).text(), 'Name')

        self.assertEqual(
            dialog.assets_tableWidget.horizontalHeaderItem(3).text(), 'Take')

        self.assertEqual(dialog.assets_tableWidget.columnCount(),
                         len(asset_vtypes) + 4)

        for i, vtype in enumerate(asset_vtypes):
            self.assertEqual(
                dialog.assets_tableWidget.horizontalHeaderItem(i + 4).text(),
                vtype.code)
コード例 #2
0
    def test_project_can_not_be_None(self):
        """testing if a IntegrityError will be raised when the project
        attribute is None
        """
        vbase = VersionableBase()
        vbase._name = "Test"
        vbase._project = None

        db.setup()
        db.session.add(vbase)

        self.assertRaises(IntegrityError, db.session.commit)
コード例 #3
0
    def save(self):
        """saves the asset to the related projects database
        """
        if db.session is None:
            db.setup()

        if self not in db.session:
            logger.debug("adding %s to the session" % self)
            db.session.add(self)

        logger.debug("saving the asset %s" % self)
        db.session.commit()
コード例 #4
0
 def test_project_can_not_be_None(self):
     """testing if a IntegrityError will be raised when the project
     attribute is None
     """
     vbase = VersionableBase()
     vbase._name = "Test"
     vbase._project = None
     
     db.setup()
     db.session.add(vbase)
     
     self.assertRaises(IntegrityError, db.session.commit)
コード例 #5
0
 def __init__(self, parent=None, project=None):
     super(MainDialog, self).__init__(parent)
     self.setupUi(self)
     
     if db.session is None:
         db.setup()
     
     self.resolution_presets = conf.resolution_presets
     self.project = project
     
     self._setup_signals()
     self._setup_defaults()
     
     self.update_UI_from_project(self.project)
コード例 #6
0
    def __init__(self, parent=None, project=None):
        super(MainDialog, self).__init__(parent)
        self.setupUi(self)

        if db.session is None:
            db.setup()

        self.resolution_presets = conf.resolution_presets
        self.project = project

        self._setup_signals()
        self._setup_defaults()

        self.update_UI_from_project(self.project)
コード例 #7
0
    def test_persistence_of_IOMixin(self):
        """testing the persistence of IOMixedInClass
        """
        db.setup()
        db.session.add(self.test_io_mixed_in_obj)
        db.session.commit()

        # now delete the object and try to retrieve it back
        del self.test_io_mixed_in_obj

        io_mixed_in_obj_DB = db.session.query(IOMixedInClass).first()

        # check the attributes
        self.assertEqual(io_mixed_in_obj_DB.inputs, self.kwargs['inputs'])
        self.assertEqual(io_mixed_in_obj_DB.outputs, self.kwargs['outputs'])
コード例 #8
0
    def test_assets_tableWidget_horizontal_labels_are_set_properly(self):
        """testing if the assets_tableWidget horizontal labels are filled with
        all the possible VersionTypes for assets
        """
        
        db.setup()
        
        asset_vtypes = VersionType.query()\
            .filter(VersionType.type_for=='Asset')\
            .order_by(VersionType.name)\
            .all()
        
        dialog = status_manager.MainDialog()
#        self.show_dialog(dialog)
        
        self.assertEqual(
            dialog.assets_tableWidget.horizontalHeaderItem(0).text(),
            'Thumbnail'
        )
        
        self.assertEqual(
            dialog.assets_tableWidget.horizontalHeaderItem(1).text(),
            'Type'
        )
        
        self.assertEqual(
            dialog.assets_tableWidget.horizontalHeaderItem(2).text(),
            'Name'
        )
        
        self.assertEqual(
            dialog.assets_tableWidget.horizontalHeaderItem(3).text(),
            'Take'
        )
        
        self.assertEqual(
            dialog.assets_tableWidget.columnCount(),
            len(asset_vtypes) + 4
        )
        
        for i, vtype in enumerate(asset_vtypes):
            self.assertEqual(
                dialog.assets_tableWidget.horizontalHeaderItem(i + 4).text(),
                vtype.code
            )
コード例 #9
0
 def setUp(self):
     """setup the test
     """
     # -----------------------------------------------------------------
     # start of the setUp
     conf.database_url = "sqlite://"
     
     db.setup()
     
     # create the environment variable and point it to a temp directory
     self.temp_config_folder = tempfile.mkdtemp()
     self.temp_projects_folder = tempfile.mkdtemp()
     
     os.environ["OYPROJECTMANAGER_PATH"] = self.temp_config_folder
     os.environ[conf.repository_env_key] = self.temp_projects_folder
     
     # for PyQt4
     self.app = QtGui.QApplication(sys.argv)
コード例 #10
0
    def setUp(self):
        """setup the test
        """
        # -----------------------------------------------------------------
        # start of the setUp
        conf.database_url = "sqlite://"

        db.setup()

        # create the environment variable and point it to a temp directory
        self.temp_config_folder = tempfile.mkdtemp()
        self.temp_projects_folder = tempfile.mkdtemp()

        os.environ["OYPROJECTMANAGER_PATH"] = self.temp_config_folder
        os.environ[conf.repository_env_key] = self.temp_projects_folder

        # for PyQt4
        self.app = QtGui.QApplication(sys.argv)
コード例 #11
0
 def __init__(self, parent=None):
     super(MainDialog, self).__init__(parent)
     self.setupUi(self)
     
     # setup the database
     if db.session is None:
         db.setup()
     
     # change the window title
     self.setWindowTitle(
         'Status Manager | ' + \
         'oyProjectManager v' + oyProjectManager.__version__
     )
     
     # data attributes
     self.projects_comboBox.projects = []
     
     self.setup_signals()
     self.setup_defaults()
コード例 #12
0
 def test_persistence_of_IOMixin(self):
     """testing the persistence of IOMixedInClass
     """
     db.setup()
     db.session.add(self.test_io_mixed_in_obj)
     db.session.commit()
     
     # now delete the object and try to retrieve it back
     del self.test_io_mixed_in_obj
     
     io_mixed_in_obj_DB = db.session.query(IOMixedInClass).first()
     
     # check the attributes
     self.assertEqual(
         io_mixed_in_obj_DB.inputs, self.kwargs['inputs']
     )
     self.assertEqual(
         io_mixed_in_obj_DB.outputs, self.kwargs['outputs']
     )
コード例 #13
0
ファイル: project.py プロジェクト: tws0002/oyprojectmanager
    def __new__(cls, name=None, code=None, client=None):
        """the overridden __new__ method to manage the creation of a Project
        instances.
        
        If the Project is created before then calling Project() for a second
        time, may be in another Python session will return the Project instance
        from the database.
        """

        # check the name argument
        if name:
            # condition the name
            name = Project._condition_name(name)

            # now get the instance from the db
            if db.session is None:
                # create the session first
                logger.debug("db.session is None, setting up a new session")
                db.setup()

            proj_db = Project.query().filter_by(name=name).first()

            if proj_db is not None:
                # return the database instance
                logger.debug("found the project in the database")
                logger.debug("returning the Project instance from the "
                             "database")

                # skip the __init__
                proj_db.__skip_init__ = None

                from oyProjectManager import conf
                proj_db.conf = conf

                return proj_db
            else:
                logger.debug("Project doesn't exists")

        # just create it normally
        logger.debug("returning a normal Project instance")
        return super(Project, cls).__new__(cls, name, code, client)
コード例 #14
0
ファイル: project.py プロジェクト: dshlai/oyprojectmanager
 def __new__(cls, name=None, code=None, client=None):
     """the overridden __new__ method to manage the creation of a Project
     instances.
     
     If the Project is created before then calling Project() for a second
     time, may be in another Python session will return the Project instance
     from the database.
     """
     
     # check the name argument
     if name:
         # condition the name
         name = Project._condition_name(name)
         
         # now get the instance from the db
         if db.session is None:
             # create the session first
             logger.debug("db.session is None, setting up a new session")
             db.setup()
         
         proj_db = Project.query().filter_by(name=name).first()
         
         if proj_db is not None:
             # return the database instance
             logger.debug("found the project in the database")
             logger.debug("returning the Project instance from the "
                           "database")
             
             # skip the __init__
             proj_db.__skip_init__ = None
             
             from oyProjectManager import conf
             proj_db.conf = conf
             
             return proj_db
         else:
             logger.debug("Project doesn't exists")
     
     # just create it normally
     logger.debug("returning a normal Project instance")
     return super(Project, cls).__new__(cls, name, code, client)
コード例 #15
0
ファイル: project.py プロジェクト: tws0002/oyprojectmanager
    def save(self):
        """Saves the Project related information to the database.
        
        If there is no ``.metadata.db`` file it will be created, but be
        careful that the project structure will not be created. The safest way
        to both create the project structure and the .metadata.db file is to
        call the :meth:`~oyProjectManager.models.project.Project.create`
        method.
        """

        logger.debug("saving project settings to %s" % db.database_url)

        # create the database
        if db.session is None:
            logger.debug("there is no session, creating a new one")
            db.setup()

        if self not in db.session:
            db.session.add(self)

        db.session.commit()
コード例 #16
0
ファイル: project.py プロジェクト: dshlai/oyprojectmanager
 def save(self):
     """Saves the Project related information to the database.
     
     If there is no ``.metadata.db`` file it will be created, but be
     careful that the project structure will not be created. The safest way
     to both create the project structure and the .metadata.db file is to
     call the :meth:`~oyProjectManager.models.project.Project.create`
     method.
     """
     
     logger.debug("saving project settings to %s" % db.database_url)
     
     # create the database
     if db.session is None:
         logger.debug("there is no session, creating a new one")
         db.setup()
     
     if self not in db.session:
         db.session.add(self)
     
     db.session.commit()
コード例 #17
0
ファイル: test_db.py プロジェクト: dshlai/oyprojectmanager
 def test_db_setup_called_multiple_times(self):
     """testing if no error raised when calling the db.setup() multiple
     times
     """
     db.setup()
     db.setup()
     db.setup()
コード例 #18
0
ファイル: test_db.py プロジェクト: tws0002/oyprojectmanager
 def test_db_setup_called_multiple_times(self):
     """testing if no error raised when calling the db.setup() multiple
     times
     """
     db.setup()
     db.setup()
     db.setup()
コード例 #19
0
 def test_another_class_mixed_in_with_IOMixin(self):
     """testing if everything works properly if more than one class is mixed
     in with the IOMixin
     """
     db.setup()
     new_io_mixed_in_obj2 = IOMixedInClass2(**self.kwargs)
     db.session.add(self.test_io_mixed_in_obj)
     db.session.add(new_io_mixed_in_obj2)
     db.session.commit()
     
     # delete them and retrieve back from DB
     del new_io_mixed_in_obj2
     del self.test_io_mixed_in_obj
     
     a = db.query(IOMixedInClass).first()
     b = db.query(IOMixedInClass2).first()
     
     self.assertEqual(a.inputs, self.kwargs['inputs'])
     self.assertEqual(a.outputs, self.kwargs['outputs'])
     
     self.assertEqual(b.inputs, self.kwargs['inputs'])
     self.assertEqual(b.outputs, self.kwargs['outputs'])
コード例 #20
0
    def test_another_class_mixed_in_with_IOMixin(self):
        """testing if everything works properly if more than one class is mixed
        in with the IOMixin
        """
        db.setup()
        new_io_mixed_in_obj2 = IOMixedInClass2(**self.kwargs)
        db.session.add(self.test_io_mixed_in_obj)
        db.session.add(new_io_mixed_in_obj2)
        db.session.commit()

        # delete them and retrieve back from DB
        del new_io_mixed_in_obj2
        del self.test_io_mixed_in_obj

        a = db.query(IOMixedInClass).first()
        b = db.query(IOMixedInClass2).first()

        self.assertEqual(a.inputs, self.kwargs['inputs'])
        self.assertEqual(a.outputs, self.kwargs['outputs'])

        self.assertEqual(b.inputs, self.kwargs['inputs'])
        self.assertEqual(b.outputs, self.kwargs['outputs'])
コード例 #21
0
    def __init__(self, parent=None):
        super(MainDialog, self).__init__(parent)
        self.setupUi(self)

        # change the window title
        self.setWindowTitle(
            self.windowTitle() + ' | ' + \
            'oyProjectManager v' + oyProjectManager.__version__
        )

        # center to the window
        self._center_window()

        # create cache attributes
        self.projects_comboBox.projects = []
        self.sequences_comboBox.sequences = []
        self.shots_comboBox.shots = []

        # setup the database
        if db.session is None:
            db.setup()

        self._setup_signals()
        self._set_defaults()
コード例 #22
0
 def __init__(self, parent=None):
     super(MainDialog, self).__init__(parent)
     self.setupUi(self)
     
     # change the window title
     self.setWindowTitle(
         self.windowTitle() + ' | ' + \
         'oyProjectManager v' + oyProjectManager.__version__
     )
     
     # center to the window
     self._center_window()
     
     # create cache attributes
     self.projects_comboBox.projects = []
     self.sequences_comboBox.sequences = []
     self.shots_comboBox.shots = []
     
     # setup the database
     if db.session is None:
         db.setup()
     
     self._setup_signals()
     self._set_defaults()
コード例 #23
0
    def test_assets_tableWidget_is_filled_with_Asset_data(self):
        """testing if the assets_tableWidget is filled with asset data properly
        """
        
        db.setup()
        
        # create a project
        proj1 = Project('Test Project 1')
        proj1.save()
        
        proj2 = Project('Test Project 2')
        proj2.save()
        
        asset_vtypes = VersionType.query()\
            .filter(VersionType.type_for=='Asset')\
            .order_by(VersionType.name)\
            .all()
        
        admin = User.query().first()
        
        asset1 = Asset(proj1, 'Test Asset 1', type='Char')
        asset1.save()
        
        asset2 = Asset(proj1, 'Test Asset 2', type='Prop')
        asset2.save()
        
        asset3 = Asset(proj1, 'Test Asset 3', type='Environment')
        asset3.save()
        
        asset4 = Asset(proj1, 'Test Asset 4', type='Prop')
        asset4.save()
        
        # versions for asset1
        version1 = Version(
            version_of=asset1,
            base_name=asset1.code,
            type=asset_vtypes[0],
            created_by=admin,
            status=conf.status_list[0]
        )
        version1.save()
        
        version2 = Version(
            version_of=asset1,
            base_name=asset1.code,
            type=asset_vtypes[1],
            created_by=admin,
            status=conf.status_list[1]
        )
        version2.save()
        
        version3 = Version(
            version_of=asset1,
            base_name=asset1.code,
            type=asset_vtypes[2],
            created_by=admin,
            status=conf.status_list[2]
        )
        version3.save()
        
        # version for asset1 with different takes
        version4 = Version(
            version_of=asset1,
            base_name=asset1.code,
            type=asset_vtypes[3],
            created_by=admin,
            status=conf.status_list[3],
            take_name='Test_A'
        )
        version4.save()
        
        version5 = Version(
            version_of=asset1,
            base_name=asset1.code,
            type=asset_vtypes[4],
            created_by=admin,
            status=conf.status_list[4],
            take_name='Test_A'
        )
        version5.save()
        
        version6 = Version(
            version_of=asset1,
            base_name=asset1.code,
            type=asset_vtypes[5],
            created_by=admin,
            status=conf.status_list[4],
            take_name='Test_B'
        )
        version6.save()
        
        version7 = Version(
            version_of=asset1,
            base_name=asset1.code,
            type=asset_vtypes[5],
            created_by=admin,
            status=conf.status_list[4],
            take_name='Test_B'
        )
        version7.save()
           
        dialog = status_manager.MainDialog()
#        self.show_dialog(dialog)      
        
        # start tests
        
        # What we should see shoul be:
        # 
        # +-----------+-------------+--------------+--------+---------------------+
        # | Thumbnail | Type        |     Name     |  Take  | Asset Version Types |
        # +===========+=============+==============+========+=====================+
        # |  (IMAGE)  | Char        | Test Asset 1 |  MAIN  | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Char        | Test Asset 1 | Test_A | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Char        | Test Asset 1 | Test_B | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Environment | Test Asset 3 |  ----  | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Prop        | Test Asset 2 |  ----  | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Prop        | Test Asset 4 |  ----  | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        #
        
        # set the project to project1
        dialog.projects_comboBox.setCurrentIndex(0)
        
        # asset1's vtypes[0] vtypes[1] vtypes[2] vtypes[3]
        # set to assets
        dialog.tabWidget.setCurrentIndex(0)
        #self.show_dialog(dialog)
        
        # expect to see 6 rows
        self.assertEqual(6, dialog.assets_tableWidget.rowCount())
        
        # expect the assets types listed in the first column
        # first three should be Char
        dialog.assets_tableWidget.setCurrentCell(0, 1)
        self.assertEqual('Char', dialog.assets_tableWidget.currentItem().text())
        dialog.assets_tableWidget.setCurrentCell(1, 1)
        self.assertEqual('Char', dialog.assets_tableWidget.currentItem().text())
        dialog.assets_tableWidget.setCurrentCell(2, 1)
        self.assertEqual('Char', dialog.assets_tableWidget.currentItem().text())
        
        # next should be Environment
        dialog.assets_tableWidget.setCurrentCell(3, 1)
        self.assertEqual(
            'Environment',
            dialog.assets_tableWidget.currentItem().text()
        )
        
        # the next two should be Prop
        dialog.assets_tableWidget.setCurrentCell(4, 1)
        self.assertEqual(
            'Prop',
            dialog.assets_tableWidget.currentItem().text()
        )
        dialog.assets_tableWidget.setCurrentCell(5, 1)
        self.assertEqual(
            'Prop',
            dialog.assets_tableWidget.currentItem().text()
        )
コード例 #24
0
    def test_shots_tableWidget_is_filled_with_Shot_data(self):
        """testing if the shots_tableWidget is filled with shot data properly
        """
        db.setup()
        
        # create a project
        proj1 = Project('Test Project 1')
        proj1.save()
        
        proj2 = Project('Test Project 2')
        proj2.save()
        
        shot_vtypes = VersionType.query()\
            .filter(VersionType.type_for=='Shot')\
            .order_by(VersionType.name)\
            .all()
        
        admin = User.query().first()
        
        # seqs for proj1
        seq1 = Sequence(proj1, 'Test Seq 1')
        seq1.save()
        
        seq2 = Sequence(proj1, 'Test Seq 2')
        seq2.save()
        
        # seqs for proj2
        seq3 = Sequence(proj2, 'Test Seq 3')
        seq3.save()
        
        seq4 = Sequence(proj2, 'Test Seq 4')
        seq4.save()
        
        # shots for seq1
        shot1 = Shot(seq1, 1)
        shot1.save()
        
        shot2 = Shot(seq1, 2)
        shot2.save()
        
        shot3 = Shot(seq1, 3)
        shot3.save()
        
        # shots for seq2
        shot4 = Shot(seq2, 4)
        shot4.save()
        
        shot5 = Shot(seq2, 5)
        shot5.save()
        
        shot6 = Shot(seq2, 6)
        shot6.save()
        
        # shots for seq3
        shot7 = Shot(seq3, 7)
        shot7.save()
        
        shot8 = Shot(seq3, 8)
        shot8.save()
        
        # shots for seq4
        shot9 = Shot(seq4, 9)
        shot9.save()
        
        shot10 = Shot(seq4, 10)
        shot10.save()
        
        # versions for shot1
        version1 = Version(
            version_of=shot1,
            base_name=shot1.code,
            type=shot_vtypes[0],
            created_by=admin,
            status=conf.status_list[0]
        )
        version1.save()
        
        version2 = Version(
            version_of=shot1,
            base_name=shot1.code,
            type=shot_vtypes[1],
            created_by=admin,
            status=conf.status_list[1]
        )
        version2.save()
        
        # versions for shot2
        version3 = Version(
            version_of=shot2,
            base_name=shot2.code,
            type=shot_vtypes[2],
            created_by=admin,
            status=conf.status_list[2]
        )
        version3.save()
        
        version4 = Version(
            version_of=shot2,
            base_name=shot2.code,
            type=shot_vtypes[3],
            created_by=admin,
            status=conf.status_list[3],
        )
        version4.save()
        
        # versions for shot3
        version5 = Version(
            version_of=shot3,
            base_name=shot3.code,
            type=shot_vtypes[4],
            created_by=admin,
            status=conf.status_list[4],
        )
        version5.save()
        
        version6 = Version(
            version_of=shot3,
            base_name=shot3.code,
            type=shot_vtypes[5],
            created_by=admin,
            status=conf.status_list[4],
        )
        version6.save()
        
        # versions for shot4
        version7 = Version(
            version_of=shot4,
            base_name=shot4.code,
            type=shot_vtypes[5],
            created_by=admin,
            status=conf.status_list[4]
        )
        version7.save()
        
        version8 = Version(
            version_of=shot4,
            base_name=shot4.code,
            type=shot_vtypes[5],
            created_by=admin,
            status=conf.status_list[0]
        )
        version8.save()
        
        dialog = status_manager.MainDialog()
#        self.show_dialog(dialog)
        
        # start tests
        
        # set the project to project1
        dialog.projects_comboBox.setCurrentIndex(0)
        
        #self.show_dialog(dialog)
        
        # asset1's vtypes[0] vtypes[1] vtypes[2] vtypes[3]
        self.fail('test is not finished yet!')
コード例 #25
0
    def test_shots_tableWidget_is_filled_with_Shot_data(self):
        """testing if the shots_tableWidget is filled with shot data properly
        """
        db.setup()

        # create a project
        proj1 = Project('Test Project 1')
        proj1.save()

        proj2 = Project('Test Project 2')
        proj2.save()

        shot_vtypes = VersionType.query()\
            .filter(VersionType.type_for=='Shot')\
            .order_by(VersionType.name)\
            .all()

        admin = User.query().first()

        # seqs for proj1
        seq1 = Sequence(proj1, 'Test Seq 1')
        seq1.save()

        seq2 = Sequence(proj1, 'Test Seq 2')
        seq2.save()

        # seqs for proj2
        seq3 = Sequence(proj2, 'Test Seq 3')
        seq3.save()

        seq4 = Sequence(proj2, 'Test Seq 4')
        seq4.save()

        # shots for seq1
        shot1 = Shot(seq1, 1)
        shot1.save()

        shot2 = Shot(seq1, 2)
        shot2.save()

        shot3 = Shot(seq1, 3)
        shot3.save()

        # shots for seq2
        shot4 = Shot(seq2, 4)
        shot4.save()

        shot5 = Shot(seq2, 5)
        shot5.save()

        shot6 = Shot(seq2, 6)
        shot6.save()

        # shots for seq3
        shot7 = Shot(seq3, 7)
        shot7.save()

        shot8 = Shot(seq3, 8)
        shot8.save()

        # shots for seq4
        shot9 = Shot(seq4, 9)
        shot9.save()

        shot10 = Shot(seq4, 10)
        shot10.save()

        # versions for shot1
        version1 = Version(version_of=shot1,
                           base_name=shot1.code,
                           type=shot_vtypes[0],
                           created_by=admin,
                           status=conf.status_list[0])
        version1.save()

        version2 = Version(version_of=shot1,
                           base_name=shot1.code,
                           type=shot_vtypes[1],
                           created_by=admin,
                           status=conf.status_list[1])
        version2.save()

        # versions for shot2
        version3 = Version(version_of=shot2,
                           base_name=shot2.code,
                           type=shot_vtypes[2],
                           created_by=admin,
                           status=conf.status_list[2])
        version3.save()

        version4 = Version(
            version_of=shot2,
            base_name=shot2.code,
            type=shot_vtypes[3],
            created_by=admin,
            status=conf.status_list[3],
        )
        version4.save()

        # versions for shot3
        version5 = Version(
            version_of=shot3,
            base_name=shot3.code,
            type=shot_vtypes[4],
            created_by=admin,
            status=conf.status_list[4],
        )
        version5.save()

        version6 = Version(
            version_of=shot3,
            base_name=shot3.code,
            type=shot_vtypes[5],
            created_by=admin,
            status=conf.status_list[4],
        )
        version6.save()

        # versions for shot4
        version7 = Version(version_of=shot4,
                           base_name=shot4.code,
                           type=shot_vtypes[5],
                           created_by=admin,
                           status=conf.status_list[4])
        version7.save()

        version8 = Version(version_of=shot4,
                           base_name=shot4.code,
                           type=shot_vtypes[5],
                           created_by=admin,
                           status=conf.status_list[0])
        version8.save()

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

        # start tests

        # set the project to project1
        dialog.projects_comboBox.setCurrentIndex(0)

        #self.show_dialog(dialog)

        # asset1's vtypes[0] vtypes[1] vtypes[2] vtypes[3]
        self.fail('test is not finished yet!')
コード例 #26
0
    def test_assets_tableWidget_is_filled_with_Asset_data(self):
        """testing if the assets_tableWidget is filled with asset data properly
        """

        db.setup()

        # create a project
        proj1 = Project('Test Project 1')
        proj1.save()

        proj2 = Project('Test Project 2')
        proj2.save()

        asset_vtypes = VersionType.query()\
            .filter(VersionType.type_for=='Asset')\
            .order_by(VersionType.name)\
            .all()

        admin = User.query().first()

        asset1 = Asset(proj1, 'Test Asset 1', type='Char')
        asset1.save()

        asset2 = Asset(proj1, 'Test Asset 2', type='Prop')
        asset2.save()

        asset3 = Asset(proj1, 'Test Asset 3', type='Environment')
        asset3.save()

        asset4 = Asset(proj1, 'Test Asset 4', type='Prop')
        asset4.save()

        # versions for asset1
        version1 = Version(version_of=asset1,
                           base_name=asset1.code,
                           type=asset_vtypes[0],
                           created_by=admin,
                           status=conf.status_list[0])
        version1.save()

        version2 = Version(version_of=asset1,
                           base_name=asset1.code,
                           type=asset_vtypes[1],
                           created_by=admin,
                           status=conf.status_list[1])
        version2.save()

        version3 = Version(version_of=asset1,
                           base_name=asset1.code,
                           type=asset_vtypes[2],
                           created_by=admin,
                           status=conf.status_list[2])
        version3.save()

        # version for asset1 with different takes
        version4 = Version(version_of=asset1,
                           base_name=asset1.code,
                           type=asset_vtypes[3],
                           created_by=admin,
                           status=conf.status_list[3],
                           take_name='Test_A')
        version4.save()

        version5 = Version(version_of=asset1,
                           base_name=asset1.code,
                           type=asset_vtypes[4],
                           created_by=admin,
                           status=conf.status_list[4],
                           take_name='Test_A')
        version5.save()

        version6 = Version(version_of=asset1,
                           base_name=asset1.code,
                           type=asset_vtypes[5],
                           created_by=admin,
                           status=conf.status_list[4],
                           take_name='Test_B')
        version6.save()

        version7 = Version(version_of=asset1,
                           base_name=asset1.code,
                           type=asset_vtypes[5],
                           created_by=admin,
                           status=conf.status_list[4],
                           take_name='Test_B')
        version7.save()

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

        # start tests

        # What we should see shoul be:
        #
        # +-----------+-------------+--------------+--------+---------------------+
        # | Thumbnail | Type        |     Name     |  Take  | Asset Version Types |
        # +===========+=============+==============+========+=====================+
        # |  (IMAGE)  | Char        | Test Asset 1 |  MAIN  | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Char        | Test Asset 1 | Test_A | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Char        | Test Asset 1 | Test_B | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Environment | Test Asset 3 |  ----  | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Prop        | Test Asset 2 |  ----  | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        # |  (IMAGE)  | Prop        | Test Asset 4 |  ----  | ******************* |
        # +-----------+-------------+--------------+--------+---------------------+
        #

        # set the project to project1
        dialog.projects_comboBox.setCurrentIndex(0)

        # asset1's vtypes[0] vtypes[1] vtypes[2] vtypes[3]
        # set to assets
        dialog.tabWidget.setCurrentIndex(0)
        #self.show_dialog(dialog)

        # expect to see 6 rows
        self.assertEqual(6, dialog.assets_tableWidget.rowCount())

        # expect the assets types listed in the first column
        # first three should be Char
        dialog.assets_tableWidget.setCurrentCell(0, 1)
        self.assertEqual('Char',
                         dialog.assets_tableWidget.currentItem().text())
        dialog.assets_tableWidget.setCurrentCell(1, 1)
        self.assertEqual('Char',
                         dialog.assets_tableWidget.currentItem().text())
        dialog.assets_tableWidget.setCurrentCell(2, 1)
        self.assertEqual('Char',
                         dialog.assets_tableWidget.currentItem().text())

        # next should be Environment
        dialog.assets_tableWidget.setCurrentCell(3, 1)
        self.assertEqual('Environment',
                         dialog.assets_tableWidget.currentItem().text())

        # the next two should be Prop
        dialog.assets_tableWidget.setCurrentCell(4, 1)
        self.assertEqual('Prop',
                         dialog.assets_tableWidget.currentItem().text())
        dialog.assets_tableWidget.setCurrentCell(5, 1)
        self.assertEqual('Prop',
                         dialog.assets_tableWidget.currentItem().text())