Files
decePubClient/tests/e2e/Support/PastureAdmin.cs
T
thepraandClaude Opus 5.5 a0f07abf8c Reports, and who liked or boosted a post
Another's profile and posts can be reported from the client (/api/v1/reports): a category, words, and for a remote
account a copy to its server, which PrivaPub sends from its own actor, never naming the persona. Who liked or boosted
a post opens from its card's menu (favourited_by, reblogged_by). e2e: a report from a Mastodon account's profile
reaches PrivaPub's moderators forwarded, and a post's likes and boosts list the persona who gave them; the admin
helper the tests share moves to Support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
2026-10-06 16:47:19 +02:00

27 lines
1.0 KiB
C#

using System.Net.Http.Json;
using System.Text.Json.Nodes;
namespace decePubClient.E2E.Support
{
// PrivaPub's /clientapi as the pasture's administrator (pastureroot, whom the scenarios make): what its moderators
// and administrators see
public static class PastureAdmin
{
public const string Root = "pastureroot";
public const string Password = "Pasture-Pass-1!";
public static async Task<JsonNode> Get(string path)
{
using var http = Pasture.Http();
var login = await http.PostAsJsonAsync($"{Pasture.Api}/clientapi/user/login", new { userName = Root, password = Password });
login.EnsureSuccessStatusCode();
var jwt = (await login.Content.ReadFromJsonAsync<JsonObject>())!["token"]!.GetValue<string>();
using var request = new HttpRequestMessage(HttpMethod.Get, Pasture.Api + path);
request.Headers.Authorization = new("Bearer", jwt);
using var response = await http.SendAsync(request);
response.EnsureSuccessStatusCode();
return JsonNode.Parse(await response.Content.ReadAsStringAsync());
}
}
}