-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_parsers.py
48 lines (42 loc) · 1.18 KB
/
test_parsers.py
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
from alastria_identity.services import ContractParser
def test_get_name_in_content_return_constructor():
expected_name = 'constructor'
contract_url = 'http://example.com'
content = {
"constant": True,
"inputs": [{
"name": "",
"type": "address"
}],
"name": "identityKeys",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": False,
"stateMutability": "view",
"type": "constructor"
}
parser = ContractParser(contract_url)
name = parser.get_name_in_content(content)
assert name == expected_name
def test_get_name_in_content_return_item_with_name():
expected_name = 'identityKeys'
contract_url = 'http://example.com'
content = {
"constant": True,
"inputs": [{
"name": "",
"type": "address"
}],
"name": "identityKeys",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": False,
"stateMutability": "view",
"type": "function"
}
parser = ContractParser(contract_url)
parser.get_name_in_content(content)