make tenants/ command return an array of objects, not just name

This commit is contained in:
Michael Becker 2025-06-11 21:47:39 -04:00
parent 8c42806b9b
commit 7d535c00bc
2 changed files with 5 additions and 3 deletions

View File

@ -36,7 +36,9 @@ public class TenantsListCommand : OmsServerCommand
IEnumerable<string> tenants = oms.GetTenants(); IEnumerable<string> tenants = oms.GetTenants();
foreach (string tenant in tenants) foreach (string tenant in tenants)
{ {
ary.Add(JsonValue.Create(tenant)); JsonObject ob = new JsonObject();
ob.Add("name", JsonValue.Create(tenant));
ary.Add(ob);
} }
if (e.Context.Request.PathParts.Length == 2) if (e.Context.Request.PathParts.Length == 2)

View File

@ -59,8 +59,8 @@ public class RemoteTests
JsonObject json = JsonNode.Parse(content) as JsonObject; JsonObject json = JsonNode.Parse(content) as JsonObject;
Assert.That(json["result"].ToString(), Is.EqualTo("success")); Assert.That(json["result"].ToString(), Is.EqualTo("success"));
Assert.That(json["tenants"].AsArray().Count, Is.EqualTo(1)); // Assert.That(json["tenants"].AsArray().Count, Is.EqualTo(1));
Assert.That(json["tenants"].AsArray()[0].ToString(), Is.EqualTo("super")); Assert.That(json["tenants"].AsArray()[0]["name"].ToString(), Is.EqualTo("super"));
} }
/// <summary> /// <summary>