Add test to verify bad query behavior of xblock_handler
This commit is contained in:
committed by
Andy Armstrong
parent
8dc7f34295
commit
3afc125ecb
@@ -10,6 +10,7 @@ from xmodule.modulestore.django import modulestore, clear_existing_modulestores
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
import datetime
|
||||
import pytz
|
||||
from request_cache.middleware import RequestCache
|
||||
from xmodule.tabs import CoursewareTab, CourseInfoTab, StaticTab, DiscussionTab, ProgressTab, WikiTab
|
||||
from xmodule.modulestore.tests.sample_courses import default_block_info_tree, TOY_BLOCK_INFO_TREE
|
||||
from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOST
|
||||
@@ -275,6 +276,8 @@ class ModuleStoreTestCase(TestCase):
|
||||
# the next time they are accessed.
|
||||
# We do this at *both* setup and teardown just to be safe.
|
||||
clear_existing_modulestores()
|
||||
# clear RequestCache to emulate its clearance after each http request.
|
||||
RequestCache().clear_request_cache()
|
||||
|
||||
# Call superclass implementation
|
||||
super(ModuleStoreTestCase, self)._post_teardown()
|
||||
|
||||
@@ -217,12 +217,12 @@ class ItemFactory(XModuleFactory):
|
||||
|
||||
|
||||
@contextmanager
|
||||
def check_exact_number_of_calls(object_with_method, method, num_calls, method_name=None):
|
||||
def check_exact_number_of_calls(object_with_method, method_name, num_calls):
|
||||
"""
|
||||
Instruments the given method on the given object to verify the number of calls to the
|
||||
method is exactly equal to 'num_calls'.
|
||||
"""
|
||||
with check_number_of_calls(object_with_method, method, num_calls, num_calls, method_name):
|
||||
with check_number_of_calls(object_with_method, method_name, num_calls, num_calls):
|
||||
yield
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user