Created
August 4, 2015 08:20
-
-
Save dusual/e66646c69bd35b818d6e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_pool(settings, InnerPool): | |
conn = mongomock.Connection() | |
db = conn.db["partyPool"] | |
return db | |
def mock_get_user(user_id): | |
from data import user | |
return user | |
def create_db_api(): | |
dbapi = make_pool(settings, partyPool) | |
return dbapi | |
def setup_data(dbapi): | |
dbapi.user.insert(user) | |
dbapi.siminar.insert(siminar) | |
dbapi.tasks.insert(task) | |
class PartyTestBase(unittest.TestCase): | |
@classmethod | |
def setUpClass(cls): | |
cls.dbapi = create_db_api() | |
setup_data(cls.dbapi) | |
mock = Mock() | |
modules = {'kernel': mock, 'kernel.pool': mock.pool} | |
cls.module_patcher = patch.dict('sys.modules', modules) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment