Mark rooms needing T5DE in the room list (t5de_t5), for the client's T5 badge
CI / build (push) Successful in 30s
CI / build (push) Successful in 30s
Hosted rooms, and IMVU rooms the hub has decorations for (asked 20 at a time), on every page; hosted rooms are added to recent rooms from the hub's recent list when it has one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
08a2ed94a3
commit
d379d848c1
2 files changed
+102
-29
No files matched your search
@@ -50,6 +50,8 @@ func (h *fakeHub) Call(ctx context.Context, method, path string, body, out any)
|
||||
return json.Unmarshal([]byte(`{"room": {"n": 3, "name": "Lounge <b>", "ownerImvuId": 88, "ownerName": "Erin",
|
||||
"roomPid": 50168116, "rating": "general", "maxUsers": 10, "occupancy": 2},
|
||||
"scene": {"contents": [[1, 47477426, "37207-46"], [2, "coatcoat22", "37-11"], [3, "notherenn2", "37-12"]], "hash": "h1"}}`), out)
|
||||
case method == "GET" && strings.HasPrefix(path, "/api/v1/decorations?instances="):
|
||||
return json.Unmarshal([]byte(`{"rooms": [{"instance": "1-644", "contents": [[1, "coatcoat22", "x"]]}, {"instance": "2-17", "contents": []}]}`), out)
|
||||
case method == "GET" && path == "/api/v1/hosted-rooms":
|
||||
return json.Unmarshal([]byte(`{"rooms": [{"n": 3, "name": "Lounge", "ownerImvuId": 88, "ownerName": "Erin", "maxUsers": 10, "occupancy": 2}]}`), out)
|
||||
case method == "PUT" && path == "/api/v1/hosted-rooms/3/scene":
|
||||
@@ -241,22 +243,25 @@ func TestRoomList(t *testing.T) {
|
||||
req, _ := http.NewRequest("GET", u.String(), nil)
|
||||
x := &proxy.Exchange{URL: u, Request: req}
|
||||
r.Intercept(x)
|
||||
body := []byte(`{"customers_room_id": ["644"], "customers_id": ["1"], "num_participants": [4], "name": ["A"], "participants": [[]], "is_ap": ["0"], "odd": [{"x": 1}], "number_of_rooms": 1}`)
|
||||
body := []byte(`{"customers_room_id": ["644", "17"], "customers_id": ["1", "2"], "num_participants": [4, 1], "name": ["A", "B"], "participants": [[], []], "is_ap": ["0", "0"], "odd": [{"x": 1}, {}], "number_of_rooms": 2}`)
|
||||
out, err := x.ModifyResponse(&http.Response{StatusCode: 200}, body)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var l map[string]any
|
||||
json.Unmarshal(out, &l)
|
||||
if fmt.Sprint(l["customers_room_id"]) != "[644 2100000003]" || fmt.Sprint(l["customers_id"]) != "[1 88]" ||
|
||||
fmt.Sprint(l["num_participants"]) != "[4 2]" || fmt.Sprint(l["odd"]) != "[map[x:1] map[]]" || l["number_of_rooms"] != float64(1) {
|
||||
if fmt.Sprint(l["customers_room_id"]) != "[644 17 2100000003]" || fmt.Sprint(l["customers_id"]) != "[1 2 88]" ||
|
||||
fmt.Sprint(l["num_participants"]) != "[4 1 2]" || fmt.Sprint(l["odd"]) != "[map[x:1] map[] map[]]" || l["number_of_rooms"] != float64(2) ||
|
||||
fmt.Sprint(l["t5de_t5"]) != "[1 0 1]" { // decorated, plain, hosted
|
||||
t.Fatalf("list %s", out)
|
||||
}
|
||||
// Other pages and searches are left alone.
|
||||
// Other pages get no hosted rooms, but their decorated rooms are marked.
|
||||
u, _ = url.Parse("https://client-dynamic.imvu.com/api/rooms/rooms_list_paginated.php?page=2")
|
||||
x = &proxy.Exchange{URL: u, Request: req}
|
||||
r.Intercept(x)
|
||||
if x.ModifyResponse != nil {
|
||||
t.Fatal("changed page 2")
|
||||
out, _ = x.ModifyResponse(&http.Response{StatusCode: 200}, body)
|
||||
json.Unmarshal(out, &l)
|
||||
if fmt.Sprint(l["customers_room_id"]) != "[644 17]" || fmt.Sprint(l["t5de_t5"]) != "[1 0]" {
|
||||
t.Fatalf("page 2: %s", out)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user