Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests, changed deprecated methods count to count_documents and in…
…sert to insert_one in tests
  • Loading branch information
assigdev committed Oct 4, 2018
commit d18ad2e496fbec39bdd343f009dad16bde1004fe
8 changes: 4 additions & 4 deletions tests/unit/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async def test_load(async_mongodb):

@pytest.mark.asyncio
async def check_players(players):
count = await players.count()
count = await players.count_documents({})
assert count == 2
await check_keys_in_docs(players, ['name', 'surname', 'position'])
manuel = await players.find_one({'name': 'Manuel'})
Expand All @@ -24,7 +24,7 @@ async def check_players(players):

@pytest.mark.asyncio
async def check_championships(championships):
count = await championships.count()
count = await championships.count_documents({})
assert count == 3
await check_keys_in_docs(championships, ['year', 'host', 'winner'])

Expand All @@ -39,12 +39,12 @@ async def check_keys_in_docs(collection, keys):

@pytest.mark.asyncio
async def test_insert(async_mongodb):
async_mongodb.players.insert({
await async_mongodb.players.insert_one({
'name': 'Bastian',
'surname': 'Schweinsteiger',
'position': 'midfield'
})
count = await async_mongodb.players.count()
count = await async_mongodb.players.count_documents({})
bastian = await async_mongodb.players.find_one({'name': 'Bastian'})
assert count == 3
assert bastian.get('name') == 'Bastian'