Esempio 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)
Esempio n. 2
0
def test_interface_collision():
    input_json = {
        'interfaces': {
            '/bar.json': {'abi': BAR_ABI},
            'bar.vy': {'content': BAR_CODE}
        }
    }
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Esempio n. 3
0
def test_interface_collision():
    input_json = {
        "interfaces": {
            "/bar.json": {
                "abi": BAR_ABI
            },
            "bar.vy": {
                "content": BAR_CODE
            }
        }
    }
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Esempio n. 4
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)
Esempio n. 5
0
def test_interfaces_output():
    input_json = {
        'interfaces': {
            '/bar.json': {'abi': BAR_ABI},
            '/interface.folder/bar2.vy': {'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': "vyper", 'code': BAR_CODE}
    }
Esempio n. 6
0
def test_manifest_output():
    input_json = {
        "interfaces": {
            "/bar.json": {
                "contractTypes": {
                    "Bar": {
                        "abi": BAR_ABI
                    }
                }
            },
        }
    }
    result = get_input_dict_interfaces(input_json)
    assert isinstance(result, dict)
    assert result == {"Bar": {"type": "json", "code": BAR_ABI}}
Esempio n. 7
0
def test_interfaces_output():
    input_json = {
        "interfaces": {
            "/bar.json": {
                "abi": BAR_ABI
            },
            "/interface.folder/bar2.vy": {
                "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": "vyper",
            "code": BAR_CODE
        },
    }
Esempio n. 8
0
def test_vy_no_content():
    input_json = {"interfaces": {"bar.vy": {"abi": BAR_CODE}}}
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Esempio n. 9
0
def test_json_no_abi():
    input_json = {"interfaces": {"bar.json": {"content": BAR_ABI}}}
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Esempio n. 10
0
def test_no_interfaces():
    result = get_input_dict_interfaces({})
    assert isinstance(result, dict)
    assert not result
Esempio n. 11
0
def test_vy_no_content():
    input_json = {'interfaces': {'bar.vy': {'abi': BAR_CODE}}}
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)
Esempio n. 12
0
def test_json_no_abi():
    input_json = {'interfaces': {'bar.json': {'content': BAR_ABI}}}
    with pytest.raises(JSONError):
        get_input_dict_interfaces(input_json)