product: make community rest only

This commit is contained in:
a.tolmachev
2026-05-03 20:52:15 +00:00
parent 89761ec1e5
commit 201fe16aae
12 changed files with 77 additions and 427 deletions
+39 -6
View File
@@ -1031,10 +1031,7 @@ mod tests {
.await;
assert_eq!(response["edition"], "community");
assert_eq!(
response["supported_protocols"],
json!(["rest", "graphql", "grpc"])
);
assert_eq!(response["supported_protocols"], json!(["rest"]));
assert_eq!(response["supported_security_levels"], json!(["standard"]));
assert_eq!(
response["machine_access_modes"],
@@ -1143,7 +1140,7 @@ mod tests {
)
.await;
assert_eq!(response["items"].as_array().unwrap().len(), 3);
assert_eq!(response["items"].as_array().unwrap().len(), 1);
assert_eq!(
response["items"]
.as_array()
@@ -1151,7 +1148,7 @@ mod tests {
.iter()
.map(|item| item["protocol"].as_str().unwrap())
.collect::<Vec<_>>(),
vec!["rest", "graphql", "grpc"]
vec!["rest"]
);
for item in response["items"].as_array().unwrap() {
assert_eq!(item["supports_execution_modes"], json!(["unary"]));
@@ -1162,6 +1159,42 @@ mod tests {
}
}
#[tokio::test(flavor = "multi_thread")]
#[serial]
async fn rejects_graphql_protocol_for_community_operation_create() {
let registry = test_registry().await;
let storage_root = test_storage_root("community_graphql_reject_create");
let upstream_base_url = spawn_graphql_server().await;
let base_url = spawn_admin_api(build_test_app(registry, storage_root)).await;
let client = authorized_client(&base_url).await;
let response = client
.post(format!("{base_url}/operations"))
.json(&test_graphql_operation_payload(
&upstream_base_url,
"crm_graphql_not_in_community",
))
.send()
.await
.unwrap();
let status = response.status();
let body = response.json::<Value>().await.unwrap();
assert_eq!(status, reqwest::StatusCode::BAD_REQUEST);
assert_eq!(body["error"]["code"], "validation_error");
assert_eq!(
body["error"]["message"],
"protocol graphql is not supported in Community"
);
assert_eq!(
body["error"]["context"],
json!({
"protocol": "graphql",
"edition": "community",
})
);
}
#[tokio::test(flavor = "multi_thread")]
#[serial]
async fn rejects_unsupported_protocol_for_community_operation_create() {