feat: snapshot product suite reference assets
This commit is contained in:
@@ -75,6 +75,7 @@ class ImageStudioTests(TempDirMixin, unittest.TestCase):
|
||||
"recovery_action",
|
||||
"generation_round_key",
|
||||
"generation_slot_index",
|
||||
"reference_asset_ids",
|
||||
}.issubset(jobs_columns)
|
||||
)
|
||||
indexes = {
|
||||
@@ -843,6 +844,48 @@ class ImageStudioTests(TempDirMixin, unittest.TestCase):
|
||||
self.assertTrue(
|
||||
all(job.generation_round_key is None for job in legacy_jobs)
|
||||
)
|
||||
self.assertTrue(
|
||||
all(job.reference_asset_ids is None for job in legacy_jobs)
|
||||
)
|
||||
|
||||
self.assert_removed(temp_dir)
|
||||
|
||||
def test_create_job_freezes_valid_reference_asset_ids(self):
|
||||
with self.make_temp_dir() as temp_dir:
|
||||
config = self._config(temp_dir)
|
||||
db.init_db(config["db_path"])
|
||||
project = image_studio.create_or_get_project(
|
||||
account_alias="店铺",
|
||||
account_slug="shop",
|
||||
item_id="51100639510",
|
||||
path=config["db_path"],
|
||||
)
|
||||
source = image_studio.add_asset(
|
||||
project.id,
|
||||
image_studio.ASSET_KIND_ORIGINAL,
|
||||
path=config["db_path"],
|
||||
)
|
||||
reference = image_studio.add_asset(
|
||||
project.id,
|
||||
image_studio.ASSET_KIND_ORIGINAL,
|
||||
path=config["db_path"],
|
||||
)
|
||||
job = image_studio.create_job(
|
||||
project.id,
|
||||
source_asset_id=source.id,
|
||||
reference_asset_ids=[reference.id],
|
||||
path=config["db_path"],
|
||||
)
|
||||
|
||||
self.assertEqual("[%d]" % reference.id, job.reference_asset_ids)
|
||||
self.assertEqual([reference.id], image_studio.job_reference_asset_ids(job))
|
||||
with self.assertRaisesRegex(db.DbError, "不能包含主图"):
|
||||
image_studio.create_job(
|
||||
project.id,
|
||||
source_asset_id=source.id,
|
||||
reference_asset_ids=[source.id],
|
||||
path=config["db_path"],
|
||||
)
|
||||
|
||||
self.assert_removed(temp_dir)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user