Skip to content

Commit

Permalink
forgot to add actual test
Browse files Browse the repository at this point in the history
  • Loading branch information
fhenneke committed Jan 11, 2024
1 parent 41aba0b commit cc6dfc5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/queries/test_quote_rewards.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import unittest

import pandas.testing
from pandas import DataFrame

from src.pg_client import MultiInstanceDBFetcher


class TestBatchRewards(unittest.TestCase):
def setUp(self) -> None:
db_url = "postgres:postgres@localhost:5432/postgres"
self.fetcher = MultiInstanceDBFetcher([db_url])
with open("./populate_test_db.sql", "r", encoding="utf-8") as file:
self.fetcher.connections[0].execute(file.read())

def test_get_batch_rewards(self):
start_block, end_block = "0", "100"
batch_rewards = self.fetcher.get_quote_rewards(start_block, end_block)
expected = DataFrame(
{
"solver": [
"0x5111111111111111111111111111111111111111",
"0x5333333333333333333333333333333333333333",
"0x5444444444444444444444444444444444444444",
],
"num_quotes": [
1,
2,
1,
],
}
)
self.assertIsNone(pandas.testing.assert_frame_equal(expected, batch_rewards))


if __name__ == "__main__":
unittest.main()

0 comments on commit cc6dfc5

Please sign in to comment.