feat(ai-studio): resume hosted image jobs
This commit is contained in:
@@ -602,6 +602,53 @@ class GuiTests(TempDirMixin, unittest.TestCase):
|
||||
|
||||
self.assert_removed(temp_dir)
|
||||
|
||||
def test_image_studio_tab_shows_resume_and_job_billing_status(self):
|
||||
with self.make_temp_dir() as temp_dir:
|
||||
cfg = self.make_config(temp_dir)
|
||||
db.init_db(cfg["db_path"])
|
||||
project = image_studio.create_or_get_project(
|
||||
account_alias="alias-a",
|
||||
account_slug="alias_a",
|
||||
item_id="51100639510",
|
||||
path=cfg["db_path"],
|
||||
)
|
||||
source = image_studio.add_asset(
|
||||
project.id,
|
||||
"original",
|
||||
local_path=self.write_test_image(os.path.join(temp_dir, "source.jpg")),
|
||||
path=cfg["db_path"],
|
||||
)
|
||||
job = image_studio.create_job(
|
||||
project.id,
|
||||
source_asset_id=source.id,
|
||||
path=cfg["db_path"],
|
||||
)
|
||||
image_studio.set_job_submitted(
|
||||
job.id,
|
||||
"cmhub-task-1",
|
||||
call_id="call-1",
|
||||
points_cost=2,
|
||||
points_balance=88,
|
||||
path=cfg["db_path"],
|
||||
)
|
||||
tab = ImageStudioTab(config=cfg, db_path=cfg["db_path"])
|
||||
self.addCleanup(tab.close)
|
||||
tab._select_project(project.id)
|
||||
|
||||
self.assertEqual("继续查询任务", tab.resume_button.text())
|
||||
statuses = [
|
||||
tab.pool_table.item(row, 2).text()
|
||||
for row in range(tab.pool_table.rowCount())
|
||||
if tab.pool_table.item(row, 0).text() == "任务"
|
||||
]
|
||||
self.assertEqual(1, len(statuses))
|
||||
self.assertIn("已提交", statuses[0])
|
||||
self.assertIn("扣点2", statuses[0])
|
||||
self.assertIn("余额88", statuses[0])
|
||||
self.assertIn("call_id=call-1", statuses[0])
|
||||
|
||||
self.assert_removed(temp_dir)
|
||||
|
||||
def test_startup_update_gate_forced_blocks_and_opens_download(self):
|
||||
boxes = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user