コード例 #1
0
def test60_should_mk_required_params_return_required(create_schema):
    from schema_sugar.client.parser import _mk_required_params as mk
    assert mk(create_schema) == [
        {'help': "{'type': 'string'}", 'name': 'name'},
        {'help': "{'enum': [1, 2, 3], 'type': 'number'}", 'name': 'replica_num'},
        {"help": "{'type': 'boolean'}", 'name': 'thin_provision'},
    ]
コード例 #2
0
def test71_should_mk_optional_params_return_arg_list(create_schema):
    from schema_sugar.client.parser import _mk_optional_params as mk
    assert mk(create_schema) == [{"help": "{'type': 'string'}", 'name': '--description'}]
コード例 #3
0
def test61_should_mk_required_params_return_null(create_schema):
    from schema_sugar.client.parser import _mk_required_params as mk
    create_schema["required"] = []
    assert mk(create_schema) == []
コード例 #4
0
def test51_should_mk_positional_params_return_no_arg():
    from schema_sugar.client.parser import _mk_positional_params as mk
    parse_url = mock.Mock()
    parse_url.return_value = [(None, None, "not_arg")]
    assert mk(parse_url, "/api/v2/<mock_arg>") == []
コード例 #5
0
def test50_should_mk_positional_params_return_right_arg(client):
    from schema_sugar.client.parser import _mk_positional_params as mk
    assert mk(client.parse_url, "/api/v2/<mock_arg>") == [{"name": "mock_arg"}]