Unit test for import performance STUD-1994

Note: I have refactored the `check_mongo_calls` contextmanager to use the more generic new `check_number_of_calls` contextmanager.