mirror of
https://github.com/spacebarchat/server.git
synced 2026-07-27 05:41:09 +00:00
Fix webhook message edit test
This commit is contained in:
@@ -28,6 +28,13 @@ public static class AssertHttpExtensions {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static async Task<HttpResponseMessage> SuccessfullyHttpPatchAsJsonAsync<TValue>(string url, TValue obj) {
|
||||
var res = await Hc.PatchAsJsonAsync(url, obj);
|
||||
if (!res.IsSuccessStatusCode)
|
||||
Assert.True(res.IsSuccessStatusCode, $"Could not POST JSON to {url}: {(int)res.StatusCode} {res.StatusCode}\n{await GetFormattedErrorDetails(res)}");
|
||||
return res;
|
||||
}
|
||||
|
||||
public static async Task<HttpResponseMessage> SuccessfullyHttpDeleteAsync(string url) {
|
||||
var res = await Hc.DeleteAsync(url);
|
||||
if (!res.IsSuccessStatusCode)
|
||||
|
||||
@@ -193,6 +193,6 @@ public class WebhookTests(ITestOutputHelper testOutputHelper, TestFixture fixtur
|
||||
if (tts != null) payload.Add("tts", tts);
|
||||
if (flags != null) payload.Add("flags", flags);
|
||||
|
||||
await Assert.SuccessfullyHttpPostAsJsonAsync(Webhook.Url + "?wait=true", payload);
|
||||
await Assert.SuccessfullyHttpPatchAsJsonAsync(Webhook.Url + "/messages/" + WebhookMessage!.Id + "?wait=true", payload);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user