feat: 添加店铺邀请列表查询接口并修复 responded_at 未写入
This commit is contained in:
+48
-11
@@ -647,7 +647,7 @@ def phase6_player(s: Session, game_id):
|
||||
return player_id, service_id
|
||||
|
||||
|
||||
def phase7_shop(s_owner: Session, owner_user_id, invited_player_id):
|
||||
def phase7_shop(s_owner: Session, s_invited_player: Session, owner_user_id, invited_player_id):
|
||||
print("\n=== Phase 7: Shop ===")
|
||||
|
||||
s_owner.post(
|
||||
@@ -751,18 +751,55 @@ def phase7_shop(s_owner: Session, owner_user_id, invited_player_id):
|
||||
headers=csrf,
|
||||
)
|
||||
report(f"POST /shops/{shop_id}/invitations", code, body)
|
||||
skip(
|
||||
"POST /shops/invitations/:id/accept",
|
||||
"create invitation does not return invitation id",
|
||||
|
||||
code, body, _ = s_owner.get(
|
||||
f"{GATEWAY}/api/v1/shops/{shop_id}/invitations",
|
||||
)
|
||||
skip(
|
||||
"DELETE /shops/invitations/:id",
|
||||
"create invitation does not return invitation id",
|
||||
report(f"GET /shops/{shop_id}/invitations", code, body)
|
||||
|
||||
invitation_id = 0
|
||||
for item in pick_items(body):
|
||||
if as_int(item.get("playerId")) == invited_player_id:
|
||||
invitation_id = as_int(item.get("id"))
|
||||
break
|
||||
report_check(
|
||||
"locate invitation id",
|
||||
bool(invitation_id),
|
||||
{"id": invitation_id},
|
||||
)
|
||||
skip(
|
||||
f"DELETE /shops/{shop_id}/players/{invited_player_id}",
|
||||
"player removal depends on accepted invitation flow",
|
||||
|
||||
s_invited_player.post(
|
||||
f"{GATEWAY}/api/v1/users/me/switch-role",
|
||||
json_body={"role": "player"},
|
||||
headers=s_invited_player.csrf_headers(),
|
||||
)
|
||||
code, body, _ = s_invited_player.get(
|
||||
f"{GATEWAY}/api/v1/shops/invitations/mine",
|
||||
)
|
||||
report("GET /shops/invitations/mine", code, body)
|
||||
|
||||
if invitation_id:
|
||||
inv_csrf = s_invited_player.csrf_headers()
|
||||
code, body, _ = s_invited_player.post(
|
||||
f"{GATEWAY}/api/v1/shops/invitations/{invitation_id}/accept",
|
||||
json_body={},
|
||||
headers=inv_csrf,
|
||||
)
|
||||
report(
|
||||
f"POST /shops/invitations/{invitation_id}/accept",
|
||||
code,
|
||||
body,
|
||||
)
|
||||
|
||||
code, body, _ = s_owner.delete(
|
||||
f"{GATEWAY}/api/v1/shops/{shop_id}/players/{invited_player_id}",
|
||||
headers=csrf,
|
||||
)
|
||||
report(
|
||||
f"DELETE /shops/{shop_id}/players/{invited_player_id}",
|
||||
code,
|
||||
body,
|
||||
)
|
||||
|
||||
code, body, _ = s_owner.get(f"{GATEWAY}/api/v1/shops/mine")
|
||||
report("GET /shops/mine", code, body)
|
||||
@@ -1169,7 +1206,7 @@ def main():
|
||||
|
||||
game_id = phase5_games(s_user, s_admin)
|
||||
player_id, service_id = phase6_player(s_user, game_id)
|
||||
shop_id = phase7_shop(s_user, user_id, invited_player_id)
|
||||
shop_id = phase7_shop(s_user, s_consumer, user_id, invited_player_id)
|
||||
|
||||
phase8_order(s_consumer, s_user, player_id, service_id, shop_id)
|
||||
phase9_wallet(s_user)
|
||||
|
||||
Reference in New Issue
Block a user