test: repost queue progress

This commit is contained in:
Ankush Menat 2022-04-19 01:26:16 +05:30
parent ecdb49314f
commit 8f519545b0
2 changed files with 8 additions and 3 deletions

View File

@ -186,3 +186,10 @@ class TestRepostItemValuation(FrappeTestCase):
riv.db_set("status", "Skipped")
riv.reload()
riv.cancel() # it should cancel now
def test_queue_progress_serialization(self):
# Make sure set/tuple -> list behaviour is retained.
self.assertEqual(
[["a", "b"], ["c", "d"]],
sorted(frappe.parse_json(frappe.as_json(set([("a", "b"), ("c", "d")])))),
)

View File

@ -272,8 +272,6 @@ def validate_item_warehouse(args):
def update_args_in_repost_item_valuation(
doc, index, args, distinct_item_warehouses, affected_transactions
):
affected_transactions_list = [list(transaction) for transaction in affected_transactions]
doc.db_set(
{
"items_to_be_repost": json.dumps(args, default=str),
@ -281,7 +279,7 @@ def update_args_in_repost_item_valuation(
{str(k): v for k, v in distinct_item_warehouses.items()}, default=str
),
"current_index": index,
"affected_transactions": json.dumps(affected_transactions_list),
"affected_transactions": frappe.as_json(affected_transactions),
}
)