// // Copyright 2023 Zesty Tech Ltd. All rights reserved. // Use is subject to license terms. // use serde_json as json; use zesty_api as zapi; #[test] fn location() { let location = zapi::Location::Aws(zapi::AwsRegion::UsEast1); let _ = match location { zapi::Location::Aws(_) => Some(0), zapi::Location::Azure(_) => None, zapi::Location::Gcp(_) => None, _ => panic!("Unexpected location"), }; } #[test] fn aws_region() { let aws = zapi::AwsRegion::UsWest2; let aws = json::json!({ "region": aws }); let text = json::to_string(&aws).unwrap(); assert_eq!(text, r#"{"region":"us-west-2"}"#); } #[test] fn vendor() { let vendor = zapi::Vendor::Aks; let text = json::to_string(&vendor).unwrap(); assert_eq!(text, r#""AKS""#); } const CLUSTER: &str = r#" { "name": "Test cluster name", "id": "ac8671a1-e084-4aed-b15f-b5f94f3ec726", "vendor": "EKS", "location": "us-east-1", "connected": false, "description": "Test cluster description", "version": "1.26", "platform_version": "eks.2", "zesty": { "installed": "0.0.0-alpha.3", "update": "0.0.0-beta.0" } } "#; #[test] fn cluster() { let cluster = json::from_str::(CLUSTER).unwrap(); assert_eq!(cluster.vendor, zapi::Vendor::Eks); }