Exemplo n.º 1
0
def test_interfaces_wrong_suffix():
    input_json = {'interfaces': {'foo.abi': {'content': FOO_CODE}}}
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)

    input_json = {'interfaces': {'interface.folder/foo': {'content': FOO_CODE}}}
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Exemplo n.º 2
0
def test_interface_collision():
    input_json = {
        'interfaces': {
            '/bar.json': {'abi': BAR_ABI},
            'bar.sri': {'content': BAR_CODE}
        }
    }
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Exemplo n.º 3
0
def test_interfaces_output():
    input_json = {
        'interfaces': {
            '/bar.json': {'abi': BAR_ABI},
            '/interface.folder/bar2.sri': {'content': BAR_CODE}
        }
    }
    result = get_input_dict_interfaces(input_json)
    assert isinstance(result, dict)
    assert result == {
        'bar': {'type': "json", 'code': BAR_ABI},
        'interface.folder/bar2': {'type': "srilang", 'code': BAR_CODE}
    }
Exemplo n.º 4
0
def test_sri_no_content():
    input_json = {'interfaces': {'bar.sri': {'abi': BAR_CODE}}}
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Exemplo n.º 5
0
def test_json_no_abi():
    input_json = {'interfaces': {'bar.json': {'content': BAR_ABI}}}
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Exemplo n.º 6
0
def test_no_interfaces():
    result = get_input_dict_interfaces({})
    assert isinstance(result, dict)
    assert not result