-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_main.py
More file actions
66 lines (60 loc) · 2.06 KB
/
test_main.py
File metadata and controls
66 lines (60 loc) · 2.06 KB
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
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"Hello": "World"}
def test_read_routes():
value = '''query {
routes(from: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", to: "0xBB0E17EF65F82Ab018d8EDd776e8DD940327B28b") {
routeId,
fromId,
fromSymbol,
fromName,
fromPrice,
toId,
toName,
toSymbol,
toPrice,
sideId,
sideName,
sideSymbol
}
}
'''
response = client.post("/graphql", data=value)
assert response.json() == {
"data": {
"routes": [
{
"routeId": "30814e92-2eb2-4663-947b-7490c8ceb9f3",
"fromId": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0",
"fromSymbol": "MATIC",
"fromName": "Matic Token",
"fromPrice": "0.822245",
"toId": "0xbb0e17ef65f82ab018d8edd776e8dd940327b28b",
"toName": "Axie Infinity Shard",
"toSymbol": "AXS",
"toPrice": "15.89",
"sideId": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"sideName": "Tether USD",
"sideSymbol": "USDT"
},
{
"routeId": "0e04d831-971d-421a-a7f4-ee4fd4fe36ac",
"fromId": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0",
"fromSymbol": "MATIC",
"fromName": "Matic Token",
"fromPrice": "0.822245",
"toId": "0xbb0e17ef65f82ab018d8edd776e8dd940327b28b",
"toName": "Axie Infinity Shard",
"toSymbol": "AXS",
"toPrice": "15.89",
"sideId": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"sideName": "Wrapped Ether",
"sideSymbol": "WETH"
}
]
}
}