def find_asset(self, dbo):
        """Test find_asset, CRUD method

        :param dbObject dbo: dbo
        """
        self.reset(dbo)

        # 1. find find_asset from db
        with orm.db_session:
            temp_asset, _ = Asset.find_asset_by_id(self.asset.id)

            # 2. test value
            self.assert_value(temp_asset)

            temp_asset, err = Asset.find_asset_by_id(-1)

            # 3. assert on error
            self.assertEqual(err, "Asset Not Found !")
            self.assertEqual(temp_asset, None)

            # 4. find_all asset from db
            temp_assets = Asset.find_all_assets()

            # 5. test value
            self.assertEqual(len(temp_assets), 1)
            self.assert_value(temp_assets[0])
Beispiel #2
0
def seed_asset():
    # get project
    _project = Project.find_all_projects()[0]

    # create category and asset
    _assetCategory = AssetCategory.create_asset_category("sample_asset")
    return Asset.create_asset("sample_project", _project, _assetCategory)
Beispiel #3
0
    def fill_datas(self, dbo):
        """fill tables with test datas

        :param dbObject dbo: dbo
        """
        self.project = Project(name="test_project", short_name="test",
                               year_start=2020, year_end=2021)

        self.shot = Shot(duration=1, project=self.project)
        self.asset_category = AssetCategory(name="test_category")

        self.asset = Asset(name="test_asset", project=self.project,
                           asset_category=self.asset_category, lod=10)

        self.task = Task.create_task("test_task", 10, self.asset)
        # xor on asset and shot
        TaskRepository.set_trigger_constraint_on_insert(dbo)

        self.subtask = Subtask.create_subtask("test_subtask", self.task)

        self.software = Software(name="test_software")
        self.extension = Extension(name="test_software", description="test_description")

        self.extension_software = ExtensionSoftware(extension=self.extension,
                                                    software=self.software)

        self.tag_file = TagFile(name="test_tag", description="test_tag_desc")

        self.file = File.create_file("test_file", self.extension_software,
                                     1, self.tag_file, self.subtask)
    def update_asset(self, dbo):
        """Test update_asset, CRUD method

        :param dbObject dbo: dbo
        """
        self.reset(dbo)
        with orm.db_session:
            # 1. find update_asset from db
            temp_asset, _ = Asset.find_asset_by_id(self.asset.id)

            temp_asset.name = "updated_name"
            temp_asset.lod = 100

            temp_asset, _ = Asset.update_asset_by_id(temp_asset.id, temp_asset)

            # 2. assert
            self.assertEqual("updated_name", temp_asset.name)
            self.assertEqual(100, temp_asset.lod)
    def remove_asset(self, dbo):
        """Test remove_asset, CRUD method

        :param dbObject dbo: dbo
        """
        self.reset(dbo)
        with orm.db_session:
            # 1. find asset from db
            temp_asset, _ = Asset.find_asset_by_id(self.asset.id)

            # 2. remove
            Asset.remove_asset_by_id(temp_asset.id)

            # 3. re-get
            temp_asset, err = Asset.find_asset_by_id(self.asset.id)

            # 4. assert
            self.assertEqual(temp_asset, None)
            self.assertEqual("Asset Not Found !", err)
    def fill_datas(self):
        """fill tables with test datas

        :return:
        """
        self.asset_category = AssetCategory.create_asset_category("test_asset")
        self.project = Project.create_project("test_project", "test", 2020,
                                              2021)

        self.asset = Asset.create_asset("test_asset", self.project,
                                        self.asset_category, 10)
Beispiel #7
0
def seed_tasks():
    # get shot and asset (create 2 task)
    _shot = Shot.find_all_shots()[0]
    _asset = Asset.find_all_assets()[0]

    _task_shot = Task.create_task(name="shot_task_test", shot=_shot)

    # create a needed task
    _neededTask = Task.create_task("needed_task", asset=_asset)
    _neededTask2 = Task.create_task("needed_task2", asset=_asset)

    _task_asset = Task.create_task("asset_task_test",
                                   need=[_neededTask, _neededTask2], asset=_asset)

    return [_task_shot, _task_asset]
    def fill_datas(self, dbo):
        """Fill tables with test data

        :param dbObject dbo: dbo
        """
        self.project = Project(name="test_project",
                               short_name="test",
                               year_start=2020,
                               year_end=2021)

        self.shot = Shot(duration=1, project=self.project)
        self.asset_category = AssetCategory(name="test_category")

        self.asset = Asset(name="test_asset",
                           project=self.project,
                           asset_category=self.asset_category,
                           lod=10)

        # xor on asset and shot
        TaskRepository.set_trigger_constraint_on_insert(dbo)
        self.task = Task.create_task("test_task", 10, self.asset)