MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / provider_validation_errors

Function provider_validation_errors

crates/openshell-server/src/grpc/provider.rs:4508–4743  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4506
4507 #[tokio::test]
4508 async fn provider_validation_errors() {
4509 let state = test_server_state().await;
4510 let store = state.store.as_ref();
4511
4512 let create_missing_type = create_provider_record(
4513 store,
4514 Provider {
4515 metadata: Some(openshell_core::proto::datamodel::v1::ObjectMeta {
4516 id: String::new(),
4517 name: "bad-provider".to_string(),
4518 created_at_ms: 1_000_000,
4519 labels: HashMap::new(),
4520 resource_version: 0,
4521 }),
4522 r#type: String::new(),
4523 credentials: HashMap::new(),
4524 config: HashMap::new(),
4525 credential_expires_at_ms: HashMap::new(),
4526 },
4527 )
4528 .await
4529 .unwrap_err();
4530 assert_eq!(create_missing_type.code(), Code::InvalidArgument);
4531
4532 let create_missing_credentials = create_provider_record(
4533 store,
4534 Provider {
4535 metadata: Some(openshell_core::proto::datamodel::v1::ObjectMeta {
4536 id: String::new(),
4537 name: "gitlab-no-creds".to_string(),
4538 created_at_ms: 1_000_000,
4539 labels: HashMap::new(),
4540 resource_version: 0,
4541 }),
4542 r#type: "gitlab".to_string(),
4543 credentials: HashMap::new(),
4544 config: HashMap::new(),
4545 credential_expires_at_ms: HashMap::new(),
4546 },
4547 )
4548 .await
4549 .unwrap_err();
4550 assert_eq!(create_missing_credentials.code(), Code::InvalidArgument);
4551
4552 handle_import_provider_profiles(
4553 &state,
4554 Request::new(ImportProviderProfilesRequest {
4555 profiles: vec![ProviderProfileImportItem {
4556 profile: Some(ProviderProfile {
4557 id: "delegated-refresh-api".to_string(),
4558 resource_version: 0,
4559 display_name: "Delegated Refresh API".to_string(),
4560 description: String::new(),
4561 category: ProviderProfileCategory::Messaging as i32,
4562 credentials: vec![ProviderProfileCredential {
4563 name: "access_token".to_string(),
4564 description: String::new(),
4565 env_vars: vec!["DELEGATED_ACCESS_TOKEN".to_string()],

Callers

nothing calls this directly

Calls 7

test_server_stateFunction · 0.85
create_provider_recordFunction · 0.85
custom_profileFunction · 0.85
get_provider_recordFunction · 0.85
delete_provider_recordFunction · 0.85
update_provider_recordFunction · 0.85

Tested by

no test coverage detected