Commit 8268724e by Don Mitchell

check 0 sends means 0 not ignore

parent 1c17e056
...@@ -266,7 +266,7 @@ def check_mongo_calls(mongo_store, num_finds=0, num_sends=None): ...@@ -266,7 +266,7 @@ def check_mongo_calls(mongo_store, num_finds=0, num_sends=None):
""" """
if mongo_store.get_modulestore_type() == ModuleStoreEnum.Type.mongo: if mongo_store.get_modulestore_type() == ModuleStoreEnum.Type.mongo:
with check_exact_number_of_calls(mongo_store.collection, mongo_store.collection.find, num_finds): with check_exact_number_of_calls(mongo_store.collection, mongo_store.collection.find, num_finds):
if num_sends: if num_sends is not None:
with check_exact_number_of_calls( with check_exact_number_of_calls(
mongo_store.database.connection, mongo_store.database.connection,
mongo_store.database.connection._send_message, # pylint: disable=protected-access mongo_store.database.connection._send_message, # pylint: disable=protected-access
...@@ -291,7 +291,7 @@ def check_mongo_calls(mongo_store, num_finds=0, num_sends=None): ...@@ -291,7 +291,7 @@ def check_mongo_calls(mongo_store, num_finds=0, num_sends=None):
wrap_patch = patch.object(collection, 'find', find_wrap) wrap_patch = patch.object(collection, 'find', find_wrap)
wrap_patches.append(wrap_patch) wrap_patches.append(wrap_patch)
wrap_patch.start() wrap_patch.start()
if num_sends: if num_sends is not None:
connection = mongo_store.db_connection.database.connection connection = mongo_store.db_connection.database.connection
with check_exact_number_of_calls( with check_exact_number_of_calls(
connection, connection,
......
...@@ -859,7 +859,7 @@ class TestMixedModuleStore(unittest.TestCase): ...@@ -859,7 +859,7 @@ class TestMixedModuleStore(unittest.TestCase):
self.assertEqual(len(self.store.get_courses_for_wiki('edX.simple.2012_Fall')), 0) self.assertEqual(len(self.store.get_courses_for_wiki('edX.simple.2012_Fall')), 0)
self.assertEqual(len(self.store.get_courses_for_wiki('no_such_wiki')), 0) self.assertEqual(len(self.store.get_courses_for_wiki('no_such_wiki')), 0)
@ddt.data(('draft', 2, 0), ('split', 5, 0)) @ddt.data(('draft', 2, 6), ('split', 5, 2))
@ddt.unpack @ddt.unpack
def test_unpublish(self, default_ms, max_find, max_send): def test_unpublish(self, default_ms, max_find, max_send):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment