File: stdin.rs

package info (click to toggle)
icann-rdap-cli 0.0.28-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 476 kB
  • sloc: makefile: 2
file content (77 lines) | stat: -rw-r--r-- 1,764 bytes parent folder | download | duplicates (2)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#![allow(non_snake_case)]

use crate::test_jig::TestJig;

#[tokio::test(flavor = "multi_thread")]
async fn test_stdin() {
    // GIVEN
    let mut test_jig = TestJig::new_rdap_test_no_http_env().await;
    let rdap_json = r#"
    {
        "objectClassName": "autnum",
        "handle": "AS65541",
        "startAutnum": 65541,
        "endAutnum": 65541,
        "name": "AS-EXAMPLE",
        "type": "DIRECT ALLOCATION",
        "rdapConformance": [
            "rdap_level_0"
        ],
        "notices": [
            {
                "title": "Test Data",
                "description": [
                    "This is test data."
                ]
            }
        ]
    }
    "#;

    // WHEN
    test_jig.cmd.arg("--stdin").write_stdin(rdap_json);

    // THEN
    let assert = test_jig.cmd.assert();
    assert.success();
}

#[tokio::test(flavor = "multi_thread")]
async fn test_stdin_with_extra_params() {
    // GIVEN
    let mut test_jig = TestJig::new_rdap_test_no_http_env().await;
    let rdap_json = r#"
    {
        "objectClassName": "autnum",
        "handle": "AS65541",
        "startAutnum": 65541,
        "endAutnum": 65541,
        "name": "AS-EXAMPLE",
        "type": "DIRECT ALLOCATION",
        "rdapConformance": [
            "rdap_level_0"
        ],
        "notices": [
            {
                "title": "Test Data",
                "description": [
                    "This is test data."
                ]
            }
        ]
    }
    "#;

    // WHEN
    test_jig
        .cmd
        .arg("--stdin")
        .arg("--allow-unregistered-extensions")
        .arg("--check-type")
        .arg("info")
        .write_stdin(rdap_json);

    // THEN
    let assert = test_jig.cmd.assert();
    assert.success();
}