File size: 1,427 Bytes
afa0cbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use super::*;
use pretty_assertions::assert_eq;
use serde_json::json;

#[test]
fn remote_control_clients_list_params_serialize_nullable_optional_fields() {
    assert_eq!(
        serde_json::to_value(RemoteControlClientsListParams {
            environment_id: "env-123".to_string(),
            cursor: None,
            limit: None,
            order: None,
        })
        .expect("params should serialize"),
        json!({
            "environmentId": "env-123",
            "cursor": null,
            "limit": null,
            "order": null,
        })
    );
}

#[test]
fn remote_control_clients_list_params_deserialize_camel_case_fields() {
    assert_eq!(
        serde_json::from_value::<RemoteControlClientsListParams>(json!({
            "environmentId": "env-123",
            "cursor": "cursor-123",
            "limit": 10,
            "order": "asc",
        }))
        .expect("params should deserialize"),
        RemoteControlClientsListParams {
            environment_id: "env-123".to_string(),
            cursor: Some("cursor-123".to_string()),
            limit: Some(10),
            order: Some(RemoteControlClientsListOrder::Asc),
        }
    );
}

#[test]
fn remote_control_clients_revoke_response_serializes_as_empty_object() {
    assert_eq!(
        serde_json::to_value(RemoteControlClientsRevokeResponse {})
            .expect("response should serialize"),
        json!({})
    );
}