mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-30 16:01:17 -07:00
Enhancement: support qBittorrent v5.2.0 api changes (#6652)
This commit is contained in:
@@ -49,6 +49,25 @@ describe("widgets/qbittorrent/proxy", () => {
|
||||
expect(res.body).toEqual(Buffer.from("data"));
|
||||
});
|
||||
|
||||
it("accepts qBittorrent 5.2.0 no-content login responses", async () => {
|
||||
getServiceWidget.mockResolvedValue({ url: "http://qb", username: "u", password: "p" });
|
||||
|
||||
httpProxy
|
||||
.mockResolvedValueOnce([403, "application/json", Buffer.from("nope")])
|
||||
.mockResolvedValueOnce([204, null, Buffer.from("")])
|
||||
.mockResolvedValueOnce([200, "application/json", Buffer.from("data")]);
|
||||
|
||||
const req = { query: { group: "g", service: "svc", endpoint: "torrents/info", index: "0" } };
|
||||
const res = createMockRes();
|
||||
|
||||
await qbittorrentProxyHandler(req, res);
|
||||
|
||||
expect(httpProxy).toHaveBeenCalledTimes(3);
|
||||
expect(httpProxy.mock.calls[1][0]).toBe("http://qb/api/v2/auth/login");
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.body).toEqual(Buffer.from("data"));
|
||||
});
|
||||
|
||||
it("returns 401 when login succeeds but response body is not Ok.", async () => {
|
||||
getServiceWidget.mockResolvedValue({ url: "http://qb", username: "u", password: "p" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user