示例#1
0
    def test_inequality(self):
        """testing the inequality of scenes
        """
        new_seq1 = Scene(**self.kwargs)
        new_seq2 = Scene(**self.kwargs)
        new_entity = Entity(**self.kwargs)

        self.kwargs["name"] = "a different scene"
        new_seq3 = Scene(**self.kwargs)

        self.assertFalse(new_seq1 != new_seq2)
        self.assertTrue(new_seq1 != new_seq3)
        self.assertTrue(new_seq1 != new_entity)
示例#2
0
    def test_inequality(self):
        """testing the inequality of scenes
        """
        new_seq1 = Scene(**self.kwargs)
        new_seq2 = Scene(**self.kwargs)
        from stalker import Entity
        new_entity = Entity(**self.kwargs)

        self.kwargs["name"] = "a different scene"
        new_seq3 = Scene(**self.kwargs)

        assert not new_seq1 != new_seq2
        assert new_seq1 != new_seq3
        assert new_seq1 != new_entity
示例#3
0
    def test_equality(self):
        """testing the equality of scenes
        """
        new_seq1 = Scene(**self.kwargs)
        new_seq2 = Scene(**self.kwargs)
        from stalker import Entity
        new_entity = Entity(**self.kwargs)

        self.kwargs["name"] = "a different scene"
        new_seq3 = Scene(**self.kwargs)

        self.assertTrue(new_seq1 == new_seq2)
        self.assertFalse(new_seq1 == new_seq3)
        self.assertFalse(new_seq1 == new_entity)
示例#4
0
    def test_scenes_argument_is_working_properly(self):
        """testing if the scenes attribute is working properly
        """
        self.kwargs['code'] = 'NewShot'

        sce1 = Scene(name='sce1', code='sce1', project=self.test_project1)
        sce2 = Scene(name='sce2', code='sce2', project=self.test_project1)
        sce3 = Scene(name='sce3', code='sce3', project=self.test_project1)

        seqs = [sce1, sce2, sce3]
        self.kwargs['scenes'] = seqs
        new_shot = Shot(**self.kwargs)

        self.assertEqual(sorted(new_shot.scenes, key=lambda x: x.name),
                         sorted(seqs, key=lambda x: x.name))
示例#5
0
    def test_ProjectMixin_initialization(self):
        """testing if the ProjectMixin part is initialized correctly
        """
        from stalker import Status
        status1 = Status.query.filter_by(code="OH").first()

        from stalker import StatusList
        project_status_list = StatusList(name="Project Statuses",
                                         statuses=[status1],
                                         target_entity_type='Project')

        from stalker import Type
        project_type = Type(name="Commercial",
                            code='comm',
                            target_entity_type='Project')

        from stalker import Project
        new_project = Project(name="Test Project",
                              code='tp',
                              status=project_status_list[0],
                              status_list=project_status_list,
                              type=project_type,
                              repository=self.test_repository)

        self.kwargs["project"] = new_project
        new_scene = Scene(**self.kwargs)
        self.assertEqual(new_scene.project, new_project)
示例#6
0
    def test_scenes_attribute_is_working_properly(self):
        """testing if the scenes attribute is working properly
        """
        from stalker import Scene
        self.kwargs['code'] = 'NewShot'

        sce1 = Scene(name='sce1', code='sce1', project=self.test_project1)
        sce2 = Scene(name='sce2', code='sce2', project=self.test_project1)
        sce3 = Scene(name='sce3', code='sce3', project=self.test_project1)

        new_shot = Shot(**self.kwargs)

        new_shot.scenes = [sce1]
        new_shot.scenes.append(sce2)
        new_shot.scenes.append(sce3)

        seqs = [sce1, sce2, sce3]
        assert \
            sorted(new_shot.scenes, key=lambda x: x.name) == \
            sorted(seqs, key=lambda x: x.name)
示例#7
0
    def setUp(self):
        """setup the test
        """
        super(SceneTester, self).setUp()
        # create a test project, user and a couple of shots
        from stalker import Type
        self.project_type = Type(
            name="Test Project Type",
            code='test',
            target_entity_type='Project',
        )

        # create a repository
        self.repository_type = Type(
            name="Test Type",
            code='test',
            target_entity_type='Repository'
        )

        from stalker import Repository
        self.test_repository = Repository(
            name="Test Repository",
            type=self.repository_type,
        )

        # create projects
        from stalker import Project
        self.test_project = Project(
            name="Test Project 1",
            code='tp1',
            type=self.project_type,
            repository=self.test_repository,
        )

        self.test_project2 = Project(
            name="Test Project 2",
            code='tp2',
            type=self.project_type,
            repository=self.test_repository,
        )

        # the parameters
        self.kwargs = {
            "name": "Test Scene",
            'code': 'tsce',
            "description": "A test scene",
            "project": self.test_project,
        }

        # the test sequence
        self.test_scene = Scene(**self.kwargs)
        from stalker.db.session import DBSession
        DBSession.add(self.test_scene)
        DBSession.commit()
示例#8
0
    def test_ProjectMixin_initialization(self):
        """testing if the ProjectMixin part is initialized correctly
        """
        from stalker import Type
        project_type = Type(name="Commercial",
                            code='comm',
                            target_entity_type='Project')

        from stalker import Project
        new_project = Project(name="Test Project",
                              code='tp',
                              type=project_type,
                              repository=self.test_repository)

        self.kwargs["project"] = new_project
        new_scene = Scene(**self.kwargs)
        assert new_scene.project == new_project
示例#9
0
    def test_ProjectMixin_initialization(self):
        """testing if the ProjectMixin part is initialized correctly
        """
        status1 = Status(name="On Hold", code="OH")

        project_status_list = StatusList(name="Project Statuses",
                                         statuses=[status1],
                                         target_entity_type=Project)

        project_type = Type(name="Commercial",
                            code='comm',
                            target_entity_type=Project)

        new_project = Project(name="Test Project",
                              code='tp',
                              status=project_status_list[0],
                              status_list=project_status_list,
                              type=project_type,
                              repository=self.test_repository)

        self.kwargs["project"] = new_project
        new_scene = Scene(**self.kwargs)
        self.assertEqual(new_scene.project, new_project)
示例#10
0
    def setUp(self):
        """setup the test
        """
        super(ShotTester, self).setUp()
        # statuses
        # types
        from stalker.db.session import DBSession
        from stalker import Type
        self.test_commercial_project_type = Type(
            name="Commercial Project",
            code='comm',
            target_entity_type='Project',
        )
        DBSession.add(self.test_commercial_project_type)

        self.test_character_asset_type = Type(
            name="Character",
            code='char',
            target_entity_type='Asset',
        )
        DBSession.add(self.test_character_asset_type)

        self.test_repository_type = Type(
            name="Test Repository Type",
            code='test',
            target_entity_type='Repository'
        )
        DBSession.add(self.test_repository_type)

        # repository
        from stalker import Repository
        self.test_repository = Repository(
            name="Test Repository",
            type=self.test_repository_type,
        )
        DBSession.add(self.test_repository)

        # image format
        from stalker import ImageFormat
        self.test_image_format1 = ImageFormat(
            name='Test Image Format 1',
            width=1920,
            height=1080,
            pixel_aspect=1.0
        )
        DBSession.add(self.test_image_format1)

        self.test_image_format2 = ImageFormat(
            name='Test Image Format 2',
            width=1280,
            height=720,
            pixel_aspect=1.0
        )
        DBSession.add(self.test_image_format2)

        # project and sequences
        from stalker import Project
        self.test_project1 = Project(
            name='Test Project1',
            code='tp1',
            type=self.test_commercial_project_type,
            repository=self.test_repository,
            image_format=self.test_image_format1
        )
        DBSession.add(self.test_project1)
        DBSession.commit()

        self.test_project2 = Project(
            name='Test Project2',
            code='tp2',
            type=self.test_commercial_project_type,
            repository=self.test_repository,
            image_format=self.test_image_format1
        )
        DBSession.add(self.test_project2)
        DBSession.commit()

        from stalker import Sequence
        self.test_sequence1 = Sequence(
            name="Test Seq1",
            code='ts1',
            project=self.test_project1,
        )
        DBSession.add(self.test_sequence1)
        DBSession.commit()

        self.test_sequence2 = Sequence(
            name="Test Seq2",
            code='ts2',
            project=self.test_project1,
        )
        DBSession.add(self.test_sequence2)
        DBSession.commit()

        self.test_sequence3 = Sequence(
            name="Test Seq3",
            code='ts3',
            project=self.test_project1,
        )
        DBSession.add(self.test_sequence3)
        DBSession.commit()

        from stalker import Scene
        self.test_scene1 = Scene(
            name='Test Sce1',
            code='tsc1',
            project=self.test_project1,
        )
        DBSession.add(self.test_scene1)
        DBSession.commit()

        self.test_scene2 = Scene(
            name='Test Sce2',
            code='tsc2',
            project=self.test_project1,
        )
        DBSession.add(self.test_scene2)
        DBSession.commit()

        self.test_scene3 = Scene(
            name='Test Sce3',
            code='tsc3',
            project=self.test_project1
        )
        DBSession.add(self.test_scene3)
        DBSession.commit()

        from stalker import Asset
        self.test_asset1 = Asset(
            name="Test Asset1",
            code='ta1',
            project=self.test_project1,
            type=self.test_character_asset_type,
        )
        DBSession.add(self.test_asset1)
        DBSession.commit()

        self.test_asset2 = Asset(
            name="Test Asset2",
            code='ta2',
            project=self.test_project1,
            type=self.test_character_asset_type,
        )
        DBSession.add(self.test_asset2)
        DBSession.commit()

        self.test_asset3 = Asset(
            name="Test Asset3",
            code='ta3',
            project=self.test_project1,
            type=self.test_character_asset_type,
        )
        DBSession.add(self.test_asset3)
        DBSession.commit()

        self.kwargs = dict(
            name='SH123',
            code='SH123',
            description='This is a test Shot',
            project=self.test_project1,
            sequences=[self.test_sequence1, self.test_sequence2],
            scenes=[self.test_scene1, self.test_scene2],
            cut_in=112,
            cut_out=149,
            source_in=120,
            source_out=140,
            record_in=85485,
            status=0,
            image_format=self.test_image_format2
        )

        # create a mock shot object
        self.test_shot = Shot(**self.kwargs)
        DBSession.add(self.test_project1)
        DBSession.commit()
示例#11
0
    def setUp(self):
        """setup the test
        """
        # create statuses
        self.test_status1 = Status(name="Status1", code="STS1")
        self.test_status2 = Status(name="Status2", code="STS2")
        self.test_status3 = Status(name="Status3", code="STS3")
        self.test_status4 = Status(name="Status4", code="STS4")
        self.test_status5 = Status(name="Status5", code="STS5")

        # create a test project, user and a couple of shots
        self.project_type = Type(
            name="Test Project Type",
            code='test',
            target_entity_type=Project,
        )

        # create a status list for project
        self.project_status_list = StatusList(
            name="Project Statuses",
            statuses=[
                self.test_status1,
                self.test_status2,
                self.test_status3,
                self.test_status4,
                self.test_status5,
            ],
            target_entity_type=Project,
        )

        # create a repository
        self.repository_type = Type(name="Test Type",
                                    code='test',
                                    target_entity_type=Repository)

        self.test_repository = Repository(
            name="Test Repository",
            type=self.repository_type,
        )

        # create projects
        self.test_project = Project(
            name="Test Project 1",
            code='tp1',
            type=self.project_type,
            status_list=self.project_status_list,
            repository=self.test_repository,
        )

        self.test_project2 = Project(
            name="Test Project 2",
            code='tp2',
            type=self.project_type,
            status_list=self.project_status_list,
            repository=self.test_repository,
        )

        # the parameters
        self.kwargs = {
            "name": "Test Scene",
            'code': 'tsce',
            "description": "A test scene",
            "project": self.test_project,
        }

        # the test sequence
        self.test_scene = Scene(**self.kwargs)
示例#12
0
 def test_shots_attribute_defaults_to_empty_list(self):
     """testing if the shots attribute defaults to an empty list
     """
     new_scene = Scene(**self.kwargs)
     self.assertEqual(new_scene.shots, [])
示例#13
0
    def setUp(self):
        """setup the test
        """
        db.setup()
        db.init()

        # statuses
        self.status_new = Status.query.filter_by(code='NEW').first()
        self.status_wfd = Status.query.filter_by(code='WFD').first()
        self.status_rts = Status.query.filter_by(code='RTS').first()
        self.status_wip = Status.query.filter_by(code='WIP').first()
        self.status_prev = Status.query.filter_by(code='PREV').first()
        self.status_hrev = Status.query.filter_by(code='HREV').first()
        self.status_drev = Status.query.filter_by(code='DREV').first()
        self.status_oh = Status.query.filter_by(code='OH').first()
        self.status_stop = Status.query.filter_by(code='STOP').first()
        self.status_cmpl = Status.query.filter_by(code='CMPL').first()

        # status lists
        self.test_project_status_list = StatusList(
            name="Project Status List",
            statuses=[self.status_new, self.status_wip, self.status_cmpl],
            target_entity_type=Project,
        )

        self.test_sequence_status_list = \
            StatusList.query.filter_by(target_entity_type='Sequence').first()

        self.test_shot_status_list = \
            StatusList.query.filter_by(target_entity_type='Shot').first()

        self.test_asset_status_list = \
            StatusList.query.filter_by(target_entity_type='Asset').first()

        # types
        self.test_commercial_project_type = Type(
            name="Commercial Project",
            code='comm',
            target_entity_type=Project,
        )

        self.test_character_asset_type = Type(
            name="Character",
            code='char',
            target_entity_type=Asset,
        )

        self.test_repository_type = Type(name="Test Repository Type",
                                         code='test',
                                         target_entity_type=Repository)

        # repository
        self.test_repository = Repository(
            name="Test Repository",
            type=self.test_repository_type,
        )

        # image format
        self.test_image_format1 = ImageFormat(name='Test Image Format 1',
                                              width=1920,
                                              height=1080,
                                              pixel_aspect=1.0)

        self.test_image_format2 = ImageFormat(name='Test Image Format 2',
                                              width=1280,
                                              height=720,
                                              pixel_aspect=1.0)

        # project and sequences
        self.test_project1 = Project(name='Test Project1',
                                     code='tp1',
                                     type=self.test_commercial_project_type,
                                     status_list=self.test_project_status_list,
                                     repository=self.test_repository,
                                     image_format=self.test_image_format1)

        self.test_project2 = Project(name='Test Project2',
                                     code='tp2',
                                     type=self.test_commercial_project_type,
                                     status_list=self.test_project_status_list,
                                     repository=self.test_repository,
                                     image_format=self.test_image_format1)

        self.test_sequence1 = Sequence(
            name="Test Seq1",
            code='ts1',
            project=self.test_project1,
            status_list=self.test_sequence_status_list,
        )

        self.test_sequence2 = Sequence(
            name="Test Seq2",
            code='ts2',
            project=self.test_project1,
            status_list=self.test_sequence_status_list,
        )

        self.test_sequence3 = Sequence(
            name="Test Seq3",
            code='ts3',
            project=self.test_project1,
            status_list=self.test_sequence_status_list,
        )

        self.test_scene1 = Scene(
            name='Test Sce1',
            code='tsc1',
            project=self.test_project1,
        )

        self.test_scene2 = Scene(
            name='Test Sce2',
            code='tsc2',
            project=self.test_project1,
        )

        self.test_scene3 = Scene(name='Test Sce3',
                                 code='tsc3',
                                 project=self.test_project1)

        self.test_asset1 = Asset(
            name="Test Asset1",
            code='ta1',
            project=self.test_project1,
            status_list=self.test_asset_status_list,
            type=self.test_character_asset_type,
        )

        self.test_asset2 = Asset(
            name="Test Asset2",
            code='ta2',
            project=self.test_project1,
            status_list=self.test_asset_status_list,
            type=self.test_character_asset_type,
        )

        self.test_asset3 = Asset(
            name="Test Asset3",
            code='ta3',
            project=self.test_project1,
            status_list=self.test_asset_status_list,
            type=self.test_character_asset_type,
        )

        self.kwargs = dict(
            name='SH123',
            code='SH123',
            description='This is a test Shot',
            project=self.test_project1,
            sequences=[self.test_sequence1, self.test_sequence2],
            scenes=[self.test_scene1, self.test_scene2],
            cut_in=112,
            cut_out=149,
            source_in=120,
            source_out=140,
            record_in=85485,
            status=0,
            status_list=self.test_shot_status_list,
            image_format=self.test_image_format2)

        # create a mock shot object
        self.test_shot = Shot(**self.kwargs)
        db.DBSession.add(self.test_project1)
        db.DBSession.commit()