- Fix doctests for Accounts, Agents.Stats, Snmp to match actual behavior - Fix dynamic_extra_test vendor post-processing tests to seed sensor data - Fix activity_controller_test to seed devices for feed data - Fix session_manager_test to create browser session for test - Fix topology_test link creation for connection test - Fix device_monitor/driver_worker tests for unique job constraints - Fix accounts_test expired_tokens assertion (magic link token is expired) - Fix happy_path_test and show_events_test to seed monitor data - Fix admin user_live_test user.name -> user.email (no name field) - Fix schema_test to seed activity data - Fix mobile_qr_live_test to match actual template text - Fix SnmpKit.MIB doctests and tests for enriched return values - Fix onboarding_live, mobile_controller, mib_test weak assertions - Remove dead code and fix credo warnings
70 lines
3.4 KiB
Elixir
70 lines
3.4 KiB
Elixir
defmodule ToweropsWeb.WellKnownControllerTest do
|
|
use ToweropsWeb.ConnCase, async: true
|
|
|
|
describe "GET /.well-known/api-catalog" do
|
|
test "returns linkset+json with API entries", %{conn: conn} do
|
|
conn = get(conn, "/.well-known/api-catalog")
|
|
assert get_resp_header(conn, "content-type") == ["application/linkset+json; charset=utf-8"]
|
|
body = json_response(conn, 200)
|
|
assert is_list(body["linkset"]) and body["linkset"] != []
|
|
[entry] = body["linkset"]
|
|
assert is_binary(entry["anchor"]) and byte_size(entry["anchor"]) > 0
|
|
assert is_list(entry["service-doc"]) and entry["service-doc"] != []
|
|
assert is_list(entry["service-desc"]) and entry["service-desc"] != []
|
|
assert is_list(entry["status"]) and entry["status"] != []
|
|
end
|
|
end
|
|
|
|
describe "GET /.well-known/openid-configuration" do
|
|
test "returns OIDC discovery metadata", %{conn: conn} do
|
|
conn = get(conn, "/.well-known/openid-configuration")
|
|
body = json_response(conn, 200)
|
|
assert is_binary(body["issuer"]) and byte_size(body["issuer"]) > 0
|
|
assert is_binary(body["authorization_endpoint"]) and byte_size(body["authorization_endpoint"]) > 0
|
|
assert is_binary(body["token_endpoint"]) and byte_size(body["token_endpoint"]) > 0
|
|
assert is_binary(body["jwks_uri"]) and byte_size(body["jwks_uri"]) > 0
|
|
assert is_list(body["grant_types_supported"]) and body["grant_types_supported"] != []
|
|
assert is_list(body["response_types_supported"]) and body["response_types_supported"] != []
|
|
end
|
|
end
|
|
|
|
describe "GET /.well-known/oauth-authorization-server" do
|
|
test "returns OAuth 2.0 server metadata", %{conn: conn} do
|
|
conn = get(conn, "/.well-known/oauth-authorization-server")
|
|
body = json_response(conn, 200)
|
|
assert is_binary(body["issuer"]) and byte_size(body["issuer"]) > 0
|
|
assert is_binary(body["authorization_endpoint"]) and byte_size(body["authorization_endpoint"]) > 0
|
|
assert is_binary(body["token_endpoint"]) and byte_size(body["token_endpoint"]) > 0
|
|
end
|
|
end
|
|
|
|
describe "GET /.well-known/oauth-protected-resource" do
|
|
test "returns protected resource metadata", %{conn: conn} do
|
|
conn = get(conn, "/.well-known/oauth-protected-resource")
|
|
body = json_response(conn, 200)
|
|
assert is_binary(body["resource"]) and byte_size(body["resource"]) > 0
|
|
assert is_list(body["authorization_servers"]) and body["authorization_servers"] != []
|
|
assert is_list(body["scopes_supported"]) and body["scopes_supported"] != []
|
|
end
|
|
end
|
|
|
|
describe "GET /.well-known/mcp/server-card.json" do
|
|
test "returns MCP server card", %{conn: conn} do
|
|
conn = get(conn, "/.well-known/mcp/server-card.json")
|
|
body = json_response(conn, 200)
|
|
assert get_in(body, ["serverInfo", "name"]) == "TowerOps"
|
|
assert is_binary(get_in(body, ["serverInfo", "version"])) and byte_size(get_in(body, ["serverInfo", "version"])) > 0
|
|
assert is_binary(get_in(body, ["transport", "endpoint"])) and byte_size(get_in(body, ["transport", "endpoint"])) > 0
|
|
assert is_map(body["capabilities"]) and map_size(body["capabilities"]) > 0
|
|
end
|
|
end
|
|
|
|
describe "GET /.well-known/agent-skills/index.json" do
|
|
test "returns agent skills discovery index", %{conn: conn} do
|
|
conn = get(conn, "/.well-known/agent-skills/index.json")
|
|
body = json_response(conn, 200)
|
|
assert body["$schema"] =~ "agentskills.io"
|
|
assert body["skills"] == []
|
|
end
|
|
end
|
|
end
|