| Total Complexity | 0 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | '''test writing to config file''' |
||
| 2 | import json |
||
| 3 | from marshmallow import pprint |
||
| 4 | from domain.mining import Pool |
||
| 5 | from domain.rep import PoolRepository |
||
| 6 | from messaging.schema import PoolSchema |
||
| 7 | |||
| 8 | SCH = PoolSchema() |
||
| 9 | POOLS = PoolRepository() |
||
| 10 | SAVEDPOOLS = POOLS.readpools("backend/config/pools.conf") |
||
| 11 | |||
| 12 | POOL1 = Pool('Antminer 1', 'Name 1', 'http://url1', 'user1.', 1) |
||
| 13 | #pools.add(pool1,PoolSchema()) |
||
| 14 | POOL2 = Pool('Antminer 2', 'Name 2', 'http://url2', 'user2.', 2) |
||
| 15 | #pools.add(pool2,PoolSchema()) |
||
| 16 | SAVEDPOOLS.append(POOL1) |
||
| 17 | SAVEDPOOLS.append(POOL2) |
||
| 18 | |||
| 19 | JSON_POOLS = [SCH.dump(k).data for k in SAVEDPOOLS] |
||
| 20 | |||
| 21 | FORMATTED_JSON = json.dumps(JSON_POOLS, sort_keys=True, indent=4, ensure_ascii=False) |
||
| 22 | pprint(FORMATTED_JSON) |
||
| 23 | input('any key') |
||
| 24 |