fix(import): подтвердить обязательные гарантии второго эпика
This commit is contained in:
1 parent
31f6f00d3b
commit
ad23cd9a46
33 files changed
+3328
-18
No files matched your search
@@ -140,6 +140,51 @@ fn swagger2_projects_basic_and_api_key_header_and_query() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn swagger2_cookie_api_key_is_explicitly_unsupported_at_operation_and_preview() {
|
||||
let document = json!({
|
||||
"swagger": "2.0",
|
||||
"info": { "title": "Unsupported Swagger cookie", "version": "1" },
|
||||
"host": "security.example.test",
|
||||
"schemes": ["https"],
|
||||
"securityDefinitions": {
|
||||
"CookieKey": { "type": "apiKey", "in": "cookie", "name": "session" }
|
||||
},
|
||||
"security": [{ "CookieKey": [] }],
|
||||
"paths": { "/private": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
let operation = operation(&ir, "/private");
|
||||
assert!(matches!(
|
||||
ir.security_schemes["CookieKey"].kind,
|
||||
NormalizedSecuritySchemeKind::Unsupported { .. }
|
||||
));
|
||||
assert!(!operation.security_requirements.alternatives[0].supported);
|
||||
assert!(
|
||||
operation
|
||||
.findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == "unsupported_security_scheme")
|
||||
);
|
||||
assert!(
|
||||
operation
|
||||
.findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == "unsupported_security_requirements")
|
||||
);
|
||||
let preview = candidates(&ir);
|
||||
let candidate = candidate(&preview, "GET /private");
|
||||
assert!(
|
||||
candidate
|
||||
.findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == "unsupported_security_requirements")
|
||||
);
|
||||
assert!(candidate.draft.input_mapping.rules.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn effective_requirements_inherit_override_and_allow_explicit_no_auth() {
|
||||
let document = json!({
|
||||
|
||||
Reference in new issue
Block a user