mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
fix(schema): preserve WebAuthn payloads and align fixtures (#2710)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#[path = "parity/mod.rs"]
|
||||
mod parity_support;
|
||||
|
||||
use fluxer_admin::api::generated::types::{LookupGuildResponse, SearchGuildsResponse};
|
||||
use parity_support::{
|
||||
TEST_ACCESS_TOKEN, TEST_ADMIN_SECRET, TEST_ADMIN_USER_ID, api_fixtures, capture,
|
||||
html_normalizer, rust_server,
|
||||
@@ -48,6 +49,31 @@ fn html_normalizer_allows_intentional_rust_markup_fixes() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn guild_search_fixture_matches_the_generated_response_contract() {
|
||||
let response: SearchGuildsResponse =
|
||||
serde_json::from_str(include_str!("parity/fixtures/api/search_guilds.json"))
|
||||
.expect("guild search fixture must match the generated response contract");
|
||||
assert_eq!(response.guilds.len(), 1);
|
||||
let guild = &response.guilds[0];
|
||||
assert_eq!(guild.name, "Parity Guild");
|
||||
assert_eq!(guild.content_warning_level.as_deref(), Some(&0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn guild_lookup_fixture_matches_the_generated_response_contract() {
|
||||
let response: LookupGuildResponse =
|
||||
serde_json::from_str(include_str!("parity/fixtures/api/lookup_guild.json"))
|
||||
.expect("guild lookup fixture must match the generated response contract");
|
||||
let guild = response
|
||||
.guild
|
||||
.expect("guild lookup fixture must contain a guild");
|
||||
assert_eq!(String::from(guild.name), "Parity Guild");
|
||||
assert_eq!(guild.content_warning_level.as_deref(), Some(&0));
|
||||
assert_eq!(guild.channels.len(), 1);
|
||||
assert_eq!(guild.channels[0].content_warning_level.as_deref(), Some(&0));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn rust_admin_fixture_routes_cover_default_protected_routes() -> Result<(), Box<dyn Error>> {
|
||||
let api_server = api_fixtures::ApiFixtureServer::start_default()
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"mfa_level": 0,
|
||||
"nsfw_level": 0,
|
||||
"nsfw": false,
|
||||
"content_warning_level": null,
|
||||
"content_warning_level": 0,
|
||||
"content_warning_text": null,
|
||||
"explicit_content_filter": 2,
|
||||
"default_message_notifications": 1,
|
||||
@@ -36,7 +36,7 @@
|
||||
"parent_id": null,
|
||||
"nsfw": false,
|
||||
"nsfw_override": null,
|
||||
"content_warning_level": null,
|
||||
"content_warning_level": 0,
|
||||
"content_warning_text": null,
|
||||
"url": null
|
||||
}
|
||||
@@ -51,7 +51,6 @@
|
||||
"hoist": false,
|
||||
"mentionable": false
|
||||
}
|
||||
],
|
||||
"description": "Guild used by admin parity fixtures."
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,8 @@
|
||||
"features": ["COMMUNITY", "DISCOVERABLE"],
|
||||
"nsfw_level": 0,
|
||||
"nsfw": false,
|
||||
"content_warning_level": null,
|
||||
"content_warning_text": null,
|
||||
"description": "Guild used by admin parity fixtures.",
|
||||
"vanity_url_code": "parity"
|
||||
"content_warning_level": 0,
|
||||
"content_warning_text": null
|
||||
}
|
||||
],
|
||||
"total": 1
|
||||
|
||||
Reference in New Issue
Block a user