Skip to content

Commit

Permalink
Fixed broken tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
puentesarrin committed Feb 18, 2019
1 parent 092211d commit 9ab95cd
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,26 @@ def testQueryableMessages(self):
log.info({'address': '340 S 12th St', 'state': 'PA', 'country': 'US'})
log.info({'address': '1234 Market St', 'state': 'PA', 'country': 'US'})

cursor = self.collection.find({'levelname': 'INFO',
'msg.address': '340 N 12th St'})
query = {
'levelname': 'INFO',
'msg.address': '340 N 12th St'},
)
docs_count = self.collection.count_documents(query)
self.assertEqual(
cursor.count_documents(),
docs_count,
1,
"Expected query to return 1 "
"message; it returned %d" % cursor.count_documents()
"message; it returned %d" % docs_count()
)
self.assertEqual(cursor[0]['msg']['address'], '340 N 12th St')

cursor = self.collection.find({'levelname': 'INFO',
'msg.state': 'PA'})

query = {
'levelname': 'INFO',
'msg.state': 'PA',
}
docs_count = self.collection.count_documents(query)
self.assertEqual(
cursor.count_documents(), 3, "Didn't find all three documents"
docs_count,
3,
"Didn't find all three documents"
)

0 comments on commit 9ab95cd

Please sign in to comment.