Beispiel #1
0
    def find_asset_category(self, dbo):
        """test find asset_category, CRUD method

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

        # 1. find asset_category from db
        with orm.db_session:
            temp_asset_category, _ = AssetCategory.find_asset_category_by_id(
                self.asset_category.id)

            # 2. test value
            self.assert_value(temp_asset_category)

            temp_asset_category, err = AssetCategory.find_asset_category_by_id(
                -1)

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

            # 4. find_all asset_category from db
            temp_asset_categories = AssetCategory.find_all_asset_categories()

            # 5. test value
            self.assertEqual(len(temp_asset_categories), 1)
            self.assert_value(temp_asset_categories[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)
Beispiel #4
0
    def update_asset_category(self, dbo):
        """Test update_asset_category, CRUD method

        :param dbObject dbo: dbo
        """
        self.reset(dbo)
        with orm.db_session:
            # 1. find update_asset_category from db
            temp_asset_category, _ = AssetCategory.find_asset_category_by_id(
                self.asset_category.id)

            temp_asset_category.name = "updated_name"

            temp_asset_category, _ = AssetCategory.update_asset_category_by_id(
                temp_asset_category.id, temp_asset_category)

            # 2. assert
            self.assertEqual("updated_name", temp_asset_category.name)
    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 #6
0
    def remove_asset_category(self, dbo):
        """Test remove_asset_category, CRUD method
        :param dbObject dbo: dbo
        """
        self.reset(dbo)
        with orm.db_session:
            # 1. find asset_category from db
            temp_asset_category, _ = AssetCategory.find_asset_category_by_id(
                self.asset_category.id)

            # 2. remove
            AssetCategory.remove_asset_category_by_id(temp_asset_category.id)

            # 3. re-get
            temp_asset_category, err = AssetCategory.find_asset_category_by_id(
                self.asset_category.id)

            # 4. assert
            self.assertEqual(temp_asset_category, None)
            self.assertEqual("AssetCategory Not Found !", err)
    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)
Beispiel #8
0
    def fill_datas(self):
        """fill tables with test datas"""

        self.asset_category = AssetCategory.create_asset_category(
            "test_asset_category")