Skip to content

Commit

Permalink
2024-06-17-13-54-44 - remove-migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephKevinMachado committed Jun 17, 2024
1 parent 3e674b6 commit 44147b5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 82 deletions.
10 changes: 0 additions & 10 deletions migrations/20221022_01_pvLdZ-create-bitcoin-schema.py

This file was deleted.

28 changes: 0 additions & 28 deletions migrations/20221022_02_ivvG9-create-exchange-table.py

This file was deleted.

89 changes: 45 additions & 44 deletions test/integration/test_exchange_data_etl_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_exchange_data(self):
cursor_factory=psycopg2.extras.DictCursor
) as curr:
curr.execute(
'''SELECT id,
"""SELECT id,
name,
rank,
percenttotalvolume,
Expand All @@ -31,79 +31,80 @@ def get_exchange_data(self):
exchangeurl,
updated_unix_millis,
updated_utc
FROM bitcoin.exchange;'''
FROM bitcoin.exchange;"""
)
table_data = [dict(r) for r in curr.fetchall()]
return table_data

def test_exchange_data_etl_run(self, mocker):
mocker.patch(
'bitcoinmonitor.exchange_data_etl.get_exchange_data',
"bitcoinmonitor.exchange_data_etl.get_exchange_data",
return_value=[
r
for r in csv.DictReader(
open('test/fixtures/sample_raw_exchange_data.csv')
open("test/fixtures/sample_raw_exchange_data.csv")
)
],
)
run()
expected_result = [
{
'id': 'binance',
'name': 'Binance',
'rank': 1,
'percenttotalvolume': Decimal('25.44443'),
'volumeusd': Decimal('12712561147.79130'),
'tradingpairs': 650,
'socket': True,
'exchangeurl': 'https://www.binance.com/',
'updated_unix_millis': 1625787943298,
'updated_utc': datetime.datetime(
"id": "binance",
"name": "Binance",
"rank": 1,
"percenttotalvolume": Decimal("25.44443"),
"volumeusd": Decimal("12712561147.79130"),
"tradingpairs": 650,
"socket": True,
"exchangeurl": "https://www.binance.com/",
"updated_unix_millis": 1625787943298,
"updated_utc": datetime.datetime(
2021, 7, 8, 23, 45, 43, 298000
),
},
{
'id': 'zg',
'name': 'ZG.com',
'rank': 2,
'percenttotalvolume': Decimal('13.03445'),
'volumeusd': Decimal('6512276458.52265'),
'tradingpairs': 133,
'socket': False,
'exchangeurl': 'https://api.zg.com/',
'updated_unix_millis': 1625787941554,
'updated_utc': datetime.datetime(
"id": "zg",
"name": "ZG.com",
"rank": 2,
"percenttotalvolume": Decimal("13.03445"),
"volumeusd": Decimal("6512276458.52265"),
"tradingpairs": 133,
"socket": False,
"exchangeurl": "https://api.zg.com/",
"updated_unix_millis": 1625787941554,
"updated_utc": datetime.datetime(
2021, 7, 8, 23, 45, 41, 554000
),
},
{
'id': 'huobi',
'name': 'Huobi',
'rank': 3,
'percenttotalvolume': Decimal('5.93652'),
'volumeusd': Decimal('2966009471.83377'),
'tradingpairs': 589,
'socket': True,
'exchangeurl': 'https://www.hbg.com/',
'updated_unix_millis': 1625787943276,
'updated_utc': datetime.datetime(
"id": "huobi",
"name": "Huobi",
"rank": 3,
"percenttotalvolume": Decimal("5.93652"),
"volumeusd": Decimal("2966009471.83377"),
"tradingpairs": 589,
"socket": True,
"exchangeurl": "https://www.hbg.com/",
"updated_unix_millis": 1625787943276,
"updated_utc": datetime.datetime(
2021, 7, 8, 23, 45, 43, 276000
),
},
{
'id': 'okex',
'name': 'Okex',
'rank': 4,
'percenttotalvolume': Decimal('4.99990'),
'volumeusd': Decimal('2498051785.36013'),
'tradingpairs': 287,
'socket': False,
'exchangeurl': 'https://www.okex.com/',
'updated_unix_millis': 1625787941641,
'updated_utc': datetime.datetime(
"id": "okex",
"name": "Okex",
"rank": 4,
"percenttotalvolume": Decimal("4.99990"),
"volumeusd": Decimal("2498051785.36013"),
"tradingpairs": 287,
"socket": False,
"exchangeurl": "https://www.okex.com/",
"updated_unix_millis": 1625787941641,
"updated_utc": datetime.datetime(
2021, 7, 8, 23, 45, 41, 641000
),
},
]
result = self.get_exchange_data()
print(result)
assert expected_result == result

0 comments on commit 44147b5

Please sign in to comment.