-
Notifications
You must be signed in to change notification settings - Fork 40
/
schema_registry_calls.rs
30 lines (27 loc) · 1.13 KB
/
schema_registry_calls.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::blocking::proto_tests::get_schema_registry_url;
use schema_registry_converter::blocking::schema_registry::{
get_all_subjects, get_all_versions, perform_sr_call, SrSettings,
};
use schema_registry_converter::schema_registry_common::SrCall;
#[test]
fn test_get_all_subjects() {
let sr_settings = SrSettings::new(get_schema_registry_url());
let result = get_all_subjects(&sr_settings).unwrap();
assert!(
result.contains(&String::from("testavro-value")),
"List of subjects contains testavro-value"
);
}
#[test]
fn test_get_versions_for_testavro_value() {
let sr_settings = SrSettings::new(get_schema_registry_url());
let result = get_all_versions(&sr_settings, String::from("testavro-value")).unwrap();
assert_eq!(vec![1], result, "List of version is just one");
}
#[test]
fn test_get_schema_for_testavro_value() {
let sr_settings = SrSettings::new(get_schema_registry_url());
let sr_call = SrCall::GetBySubjectAndVersion("testavro-value", 1);
let result = perform_sr_call(&sr_settings, sr_call).unwrap();
assert_eq!(Some(1), result.version, "Returned schema has version 1");
}