Skip to content

Commit

Permalink
Refactored some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
John Furr authored and John Furr committed Dec 5, 2015
1 parent 64b90fc commit 84393eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
11 changes: 3 additions & 8 deletions mongolog/handlers.py
Expand Up @@ -76,16 +76,11 @@ def handler():
return handler
return None

@classmethod
def get_collection(cls):
def get_collection(self):
"""
Return the collection being used by the MongLogHandler returned from handler()
Return the collection being used by MongoLogHandler
"""
if hasattr(cls, "collection"):
return cls.collection
else:
handler = MongoLogHandler.handler()
return getattr(handler, "collection", None)
return getattr(self, "collection", None)

def connect(self):
major_version = int(pymongo.version.split(".")[0])
Expand Down
8 changes: 0 additions & 8 deletions mongolog/tests.py
Expand Up @@ -101,14 +101,6 @@ def remove_test_entries(self):
# Ensure that we don't have any test entries
self.assertEqual(0, self.collection.find({self.test_key: True}).count())

def test_get_collection(self):
"""
MongoLogHanlder.get_collection is a class method with
two different control paths. This test executes them both
and ensures they return the same thing
"""
self.assertEqual(self.handler.get_collection(), MongoLogHandler.get_collection())

def test_set_record_type(self):
with self.assertRaises(ValueError):
self.handler.set_record_type("bad type")
Expand Down

0 comments on commit 84393eb

Please sign in to comment.