forked from litepresence/Graphene-Metanode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunit_test_public.py
70 lines (55 loc) · 2.28 KB
/
unit_test_public.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
##!/usr/bin/env python
# DISABLE SELECT PYLINT TESTS
# pylint:
r"""
╔════════════════════════════════════════════════════╗
║ ╔═╗╦═╗╔═╗╔═╗╦ ╦╔═╗╔╗╔╔═╗ ╔╦╗╔═╗╔╦╗╔═╗╔╗╔╔═╗╔╦╗╔═╗ ║
║ ║ ╦╠╦╝╠═╣╠═╝╠═╣║╣ ║║║║╣ ║║║║╣ ║ ╠═╣║║║║ ║ ║║║╣ ║
║ ╚═╝╩╚═╩ ╩╩ ╩ ╩╚═╝╝╚╝╚═╝ ╩ ╩╚═╝ ╩ ╩ ╩╝╚╝╚═╝═╩╝╚═╝ ║
╚════════════════════════════════════════════════════╝
DATABASE VISUALIZATION CLI GUI
"""
# STANDARD MODULES
import time
from random import choice
from graphene_constants import GrapheneConstants
# GRAPHENE MODULES
from graphene_metanode_client import GrapheneTrustlessClient
from graphene_utils import at, it, jprint, two_tone
from unit_test_dbux import convert
def unit_test():
"""
instantiate a metanode client and test data methods
"""
constants = GrapheneConstants("bitshares")
metanode = GrapheneTrustlessClient(constants)
methods = {
"chain": metanode.chain,
"pairs": metanode.pairs,
"assets": metanode.assets,
"account": metanode.account,
"timing": metanode.timing,
"nodes": metanode.nodes,
"whitelist": metanode.whitelist,
"objects": metanode.objects,
}
while True:
pair = ""
asset = ""
method = choice(list(methods.keys()))
data = methods[method]
if method == "pairs":
pair = choice(constants.chain.PAIRS)
data = data[pair]
elif method == "assets":
asset = choice(constants.chain.ASSETS)
data = data[asset]
print("\033c")
print(convert("metanode", "green"))
print(it("yellow", "GrapheneTrustlessClient()"))
print(two_tone(data, "blue", "purple"))
print(it("green", f"metanode.{method} {pair}{asset}"))
print(at((0, 0, 0, 0), ""))
time.sleep(7)
if __name__ == "__main__":
unit_test()