def test_mongo_db(self): from pyramid_mongokit import mongo_db request = testing.DummyRequest() request.mongo_connection = self.mongo # MongoConnection permits multiple db with prefix: self.assertEqual(self.mongo['pm_test_bingo'], mongo_db(request, db_name='bingo')) self.assertEqual(self.mongo['pm_test_slot'], mongo_db(request, db_name='slot'))
def test_mongo_db(self): from pyramid_mongokit import mongo_db request = mock.Mock() self.assertEqual( request.mongo_connection.db, mongo_db(request) )
def test_mongo_db(self): from pyramid_mongokit import mongo_db request = mock.Mock() self.assertEqual( getattr(request.mongo_connection, os.environ['MONGO_DB_NAME']), mongo_db(request) )
def test_mongo_db(self): from pyramid_mongokit import mongo_db request = testing.DummyRequest() request.mongo_connection = self.mongo # SingleDbConnection re-write db name: self.assertEqual(self.mongo['pm_test_games'], mongo_db(request, db_name='whatever'))
def setUp(self): self.config = testing.setUp() self.config.include("pyramid_rest") self.config.include("velo") self.request = testing.DummyRequest() self.request.context = testing.DummyResource() self.request.rest_resource_url = partial(rest_resource_url, self.request) self.request.rest_resource_path = partial(rest_resource_path, self.request) self.request.POST = MultiDict() self.request.mongo_connection = mongo_connection(self.request) self.request.mongo_db = mongo_db(self.request)