fix(huya): 协作台账固定序号并支持表头排序
This commit is contained in:
@@ -1444,6 +1444,37 @@ class TestCollabCreateStrict(TestCollabBase):
|
||||
assert order.void_reason == ""
|
||||
|
||||
|
||||
class TestCollabOrderSorting(TestCollabBase):
|
||||
"""列表默认按创建顺序;表头排序走白名单,升/降序都稳定。"""
|
||||
|
||||
def test_default_order_is_creation_order(self):
|
||||
first = self._create(order_no="SORT-1", shop="乙")
|
||||
second = self._create(order_no="SORT-2", shop="甲")
|
||||
|
||||
rows, total = collab.list_orders(self.db)
|
||||
|
||||
assert total == 2
|
||||
assert [row.id for row in rows] == [first.id, second.id]
|
||||
|
||||
def test_sort_by_order_no_ascending_and_descending(self):
|
||||
self._create(order_no="SORT-B")
|
||||
self._create(order_no="SORT-A")
|
||||
|
||||
rows, _ = collab.list_orders(self.db, sort_by="order_no", sort_order="asc")
|
||||
assert [row.order_no for row in rows] == ["SORT-A", "SORT-B"]
|
||||
|
||||
rows, _ = collab.list_orders(self.db, sort_by="order_no", sort_order="desc")
|
||||
assert [row.order_no for row in rows] == ["SORT-B", "SORT-A"]
|
||||
|
||||
def test_sort_by_owner_username(self):
|
||||
self._create(order_no="SORT-OWNER-1", owner_id=self.user.id)
|
||||
self._create(order_no="SORT-OWNER-2", owner_id=self.other.id)
|
||||
|
||||
rows, _ = collab.list_orders(self.db, sort_by="owner", sort_order="asc")
|
||||
|
||||
assert [row.owner_id for row in rows] == [self.user.id, self.other.id]
|
||||
|
||||
|
||||
class TestCollabKeywordSearch(TestCollabBase):
|
||||
"""列表搜索:一个输入框打穿订单号 / 店铺 / 绑定账号·角色 / 平台区服 / 虎牙号 / 礼包 / 备注。"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user