Skip to content

Commit

Permalink
Remove async statements for @db_session annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Nov 15, 2022
1 parent f33d03a commit 94a3648
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create_operation(self, subject='1' * 20, obj=''):
return operation

@db_session
async def fill_db(self):
def fill_db(self):
# create 10 operations:
# first 5 of them are correct
# next 5 of them are incorrect
Expand All @@ -59,8 +59,8 @@ async def fill_db(self):

async def test_gossip(self):
# Test default gossip.
# Only 5 correct messages should be propagated
await self.fill_db()
# Only 6 correct messages should be propagated
self.fill_db()
await self.introduce_nodes()
await self.deliver_messages(timeout=REQUEST_INTERVAL_FOR_RANDOM_OPERATIONS * 2)
with db_session:
Expand All @@ -70,7 +70,7 @@ async def test_gossip(self):
async def test_on_request_eat_exceptions(self):
# Tests that except blocks in on_request function works as expected
# ValueError should be eaten silently
await self.fill_db()
self.fill_db()
# let's "break" the function that will be called on on_request()
self.overlay(0).db.get_operations_for_gossip = Mock(return_value=[MagicMock()])
# occurred exception should be ate by community silently
Expand All @@ -81,7 +81,7 @@ async def test_on_request_eat_exceptions(self):
async def test_no_peers(self):
# Test that no error occurs in the community, in case there is no peers
self.overlay(0).get_peers = Mock(return_value=[])
await self.fill_db()
self.fill_db()
await self.introduce_nodes()
await self.deliver_messages(timeout=REQUEST_INTERVAL_FOR_RANDOM_OPERATIONS * 2)
self.overlay(0).get_peers.assert_called()

0 comments on commit 94a3648

Please sign in to comment.