use database pymongo_test instead of test for testing
This commit is contained in:
parent
cc2c8f341c
commit
114f2f2e7c
@ -27,7 +27,7 @@ from pymongo.son import SON
|
||||
|
||||
class TestCollection(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = get_connection().test
|
||||
self.db = get_connection().pymongo_test
|
||||
|
||||
def test_collection(self):
|
||||
self.assertRaises(TypeError, Collection, self.db, 5)
|
||||
@ -63,30 +63,30 @@ class TestCollection(unittest.TestCase):
|
||||
self.assertRaises(TypeError, db.test.create_index, "hello", "world")
|
||||
|
||||
db.test.drop_indexes()
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"test.test"}))
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"pymongo_test.test"}))
|
||||
|
||||
db.test.create_index("hello", ASCENDING)
|
||||
db.test.create_index([("hello", DESCENDING), ("world", ASCENDING)])
|
||||
|
||||
count = 0
|
||||
for _ in db.system.indexes.find({"ns": u"test.test"}):
|
||||
for _ in db.system.indexes.find({"ns": u"pymongo_test.test"}):
|
||||
count += 1
|
||||
self.assertEqual(count, 2)
|
||||
|
||||
db.test.drop_indexes()
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"test.test"}))
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"pymongo_test.test"}))
|
||||
db.test.create_index("hello", ASCENDING)
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"test.test"}),
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"pymongo_test.test"}),
|
||||
SON([(u"name", u"hello_1"),
|
||||
(u"ns", u"test.test"),
|
||||
(u"ns", u"pymongo_test.test"),
|
||||
(u"key", SON([(u"hello", 1)]))]))
|
||||
|
||||
db.test.drop_indexes()
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"test.test"}))
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"pymongo_test.test"}))
|
||||
db.test.create_index([("hello", DESCENDING), ("world", ASCENDING)])
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"test.test"}),
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"pymongo_test.test"}),
|
||||
SON([(u"name", u"hello_-1_world_1"),
|
||||
(u"ns", u"test.test"),
|
||||
(u"ns", u"pymongo_test.test"),
|
||||
(u"key", SON([(u"hello", -1),
|
||||
(u"world", 1)]))]))
|
||||
|
||||
@ -96,13 +96,13 @@ class TestCollection(unittest.TestCase):
|
||||
db.test.create_index("hello", ASCENDING)
|
||||
name = db.test.create_index("goodbye", DESCENDING)
|
||||
|
||||
self.assertEqual(db.system.indexes.find({"ns": u"test.test"}).count(), 2)
|
||||
self.assertEqual(db.system.indexes.find({"ns": u"pymongo_test.test"}).count(), 2)
|
||||
self.assertEqual(name, "goodbye_-1")
|
||||
db.test.drop_index(name)
|
||||
self.assertEqual(db.system.indexes.find({"ns": u"test.test"}).count(), 1)
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"test.test"}),
|
||||
self.assertEqual(db.system.indexes.find({"ns": u"pymongo_test.test"}).count(), 1)
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"pymongo_test.test"}),
|
||||
SON([(u"name", u"hello_1"),
|
||||
(u"ns", u"test.test"),
|
||||
(u"ns", u"pymongo_test.test"),
|
||||
(u"key", SON([(u"hello", 1)]))]))
|
||||
|
||||
def test_index_info(self):
|
||||
|
||||
@ -76,12 +76,12 @@ class TestConnection(unittest.TestCase):
|
||||
def test_database_names(self):
|
||||
connection = Connection(self.host, self.port)
|
||||
|
||||
connection.test.test.save({"dummy": u"object"})
|
||||
connection.test_mike.test.save({"dummy": u"object"})
|
||||
connection.pymongo_test.test.save({"dummy": u"object"})
|
||||
connection.pymongo_test_mike.test.save({"dummy": u"object"})
|
||||
|
||||
dbs = connection.database_names()
|
||||
self.assertTrue("test" in dbs)
|
||||
self.assertTrue("test_mike" in dbs)
|
||||
self.assertTrue("pymongo_test" in dbs)
|
||||
self.assertTrue("pymongo_test_mike" in dbs)
|
||||
|
||||
def test_drop_database(self):
|
||||
connection = Connection(self.host, self.port)
|
||||
@ -89,19 +89,19 @@ class TestConnection(unittest.TestCase):
|
||||
self.assertRaises(TypeError, connection.drop_database, 5)
|
||||
self.assertRaises(TypeError, connection.drop_database, None)
|
||||
|
||||
connection.test.test.save({"dummy": u"object"})
|
||||
connection.pymongo_test.test.save({"dummy": u"object"})
|
||||
dbs = connection.database_names()
|
||||
self.assertTrue("test" in dbs)
|
||||
connection.drop_database("test")
|
||||
self.assertTrue("pymongo_test" in dbs)
|
||||
connection.drop_database("pymongo_test")
|
||||
dbs = connection.database_names()
|
||||
self.assertTrue("test" not in dbs)
|
||||
self.assertTrue("pymongo_test" not in dbs)
|
||||
|
||||
connection.test.test.save({"dummy": u"object"})
|
||||
connection.pymongo_test.test.save({"dummy": u"object"})
|
||||
dbs = connection.database_names()
|
||||
self.assertTrue("test" in dbs)
|
||||
connection.drop_database(connection.test)
|
||||
self.assertTrue("pymongo_test" in dbs)
|
||||
connection.drop_database(connection.pymongo_test)
|
||||
dbs = connection.database_names()
|
||||
self.assertTrue("test" not in dbs)
|
||||
self.assertTrue("pymongo_test" not in dbs)
|
||||
|
||||
def test_iteration(self):
|
||||
connection = Connection(self.host, self.port)
|
||||
|
||||
@ -26,7 +26,7 @@ from test_connection import get_connection
|
||||
|
||||
class TestCursor(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = Database(get_connection(), "test")
|
||||
self.db = Database(get_connection(), "pymongo_test")
|
||||
|
||||
def test_explain(self):
|
||||
a = self.db.test.find()
|
||||
|
||||
@ -44,18 +44,18 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertEqual(Database(self.connection, "test"), Database(self.connection, "test"))
|
||||
|
||||
def test_repr(self):
|
||||
self.assertEqual(repr(Database(self.connection, "test")),
|
||||
"Database(%r, u'test')" % self.connection)
|
||||
self.assertEqual(repr(Database(self.connection, "pymongo_test")),
|
||||
"Database(%r, u'pymongo_test')" % self.connection)
|
||||
|
||||
def test_get_coll(self):
|
||||
db = Database(self.connection, "test")
|
||||
db = Database(self.connection, "pymongo_test")
|
||||
self.assertEqual(db.test, db["test"])
|
||||
self.assertEqual(db.test, Collection(db, "test"))
|
||||
self.assertNotEqual(db.test, Collection(db, "mike"))
|
||||
self.assertEqual(db.test.mike, db["test.mike"])
|
||||
|
||||
def test_create_collection(self):
|
||||
db = Database(self.connection, "test")
|
||||
db = Database(self.connection, "pymongo_test")
|
||||
|
||||
db.test.insert({"hello": "world"})
|
||||
self.assertRaises(CollectionInvalid, db.create_collection, "test")
|
||||
@ -80,7 +80,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertTrue(u"test.foo" in db.collection_names())
|
||||
|
||||
def test_collection_names(self):
|
||||
db = Database(self.connection, "test")
|
||||
db = Database(self.connection, "pymongo_test")
|
||||
db.test.save({"dummy": u"object"})
|
||||
db.test.mike.save({"dummy": u"object"})
|
||||
|
||||
@ -91,7 +91,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertTrue("$" not in coll)
|
||||
|
||||
def test_drop_collection(self):
|
||||
db = Database(self.connection, "test")
|
||||
db = Database(self.connection, "pymongo_test")
|
||||
|
||||
self.assertRaises(TypeError, db.drop_collection, 5)
|
||||
self.assertRaises(TypeError, db.drop_collection, None)
|
||||
@ -114,7 +114,7 @@ class TestDatabase(unittest.TestCase):
|
||||
db.drop_collection(db.test.doesnotexist)
|
||||
|
||||
def test_validate_collection(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
|
||||
self.assertRaises(TypeError, db.validate_collection, 5)
|
||||
self.assertRaises(TypeError, db.validate_collection, None)
|
||||
@ -128,7 +128,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertTrue(db.validate_collection(db.test))
|
||||
|
||||
def test_profiling_levels(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
self.assertEqual(db.profiling_level(), OFF) #default
|
||||
|
||||
self.assertRaises(ValueError, db.set_profiling_level, 5.5)
|
||||
@ -145,7 +145,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertEqual(db.profiling_level(), OFF)
|
||||
|
||||
def test_profiling_info(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
|
||||
db.set_profiling_level(ALL)
|
||||
db.test.find()
|
||||
@ -159,7 +159,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertTrue(isinstance(info[0]["millis"], types.FloatType))
|
||||
|
||||
def test_iteration(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
|
||||
def iterate():
|
||||
[a for a in db]
|
||||
@ -167,7 +167,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertRaises(TypeError, iterate)
|
||||
|
||||
def test_errors(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
|
||||
db.reset_error_history()
|
||||
self.assertEqual(None, db.error())
|
||||
@ -194,7 +194,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertEqual(None, db.previous_error())
|
||||
|
||||
def test_password_digest(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
|
||||
self.assertRaises(TypeError, db._password_digest, 5)
|
||||
self.assertRaises(TypeError, db._password_digest, True)
|
||||
@ -205,7 +205,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertEqual(db._password_digest("password"), db._password_digest(u"password"))
|
||||
|
||||
def test_authenticate(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
db.system.users.remove({})
|
||||
db.system.users.insert({"user": u"mike", "pwd": db._password_digest("password")})
|
||||
|
||||
@ -222,7 +222,7 @@ class TestDatabase(unittest.TestCase):
|
||||
db.logout()
|
||||
|
||||
def test_id_ordering(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
db.test.remove({})
|
||||
|
||||
db.test.insert({"hello": "world", "_id": 5})
|
||||
@ -234,7 +234,7 @@ class TestDatabase(unittest.TestCase):
|
||||
break
|
||||
|
||||
def test_deref(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
db.test.remove({})
|
||||
|
||||
self.assertRaises(TypeError, db.dereference, 5)
|
||||
@ -249,7 +249,7 @@ class TestDatabase(unittest.TestCase):
|
||||
|
||||
# TODO some of these tests belong in the collection level testing.
|
||||
def test_save_find_one(self):
|
||||
db = Database(self.connection, "test")
|
||||
db = Database(self.connection, "pymongo_test")
|
||||
db.test.remove({})
|
||||
|
||||
a_doc = SON({"hello": u"world"})
|
||||
@ -276,7 +276,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertEqual(count, 1)
|
||||
|
||||
def test_remove(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
db.test.remove({})
|
||||
|
||||
self.assertRaises(TypeError, db.test.remove, 5)
|
||||
@ -314,7 +314,7 @@ class TestDatabase(unittest.TestCase):
|
||||
self.assertFalse(db.test.find_one())
|
||||
|
||||
def test_save_a_bunch(self):
|
||||
db = self.connection.test
|
||||
db = self.connection.pymongo_test
|
||||
db.test.remove({})
|
||||
|
||||
for i in xrange(1000):
|
||||
|
||||
@ -26,7 +26,7 @@ from gridfs.grid_file import GridFile
|
||||
|
||||
class TestGridFile(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = get_connection().test
|
||||
self.db = get_connection().pymongo_test
|
||||
|
||||
def test_basic(self):
|
||||
self.db._files.remove({})
|
||||
|
||||
@ -24,7 +24,7 @@ from test_connection import get_connection
|
||||
|
||||
class TestGridfs(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = get_connection().test
|
||||
self.db = get_connection().pymongo_test
|
||||
self.db._files.remove({})
|
||||
self.db._chunks.remove({})
|
||||
self.fs = gridfs.GridFS(self.db)
|
||||
|
||||
@ -51,16 +51,16 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertRaises(ConnectionFailure, Mongo, "test", "somedomainthatdoesntexist.org")
|
||||
self.assertRaises(ConnectionFailure, Mongo, "test", self.host, 123456789)
|
||||
|
||||
self.assertTrue(Mongo("test", self.host, self.port))
|
||||
self.assertTrue(Mongo("pymongo_test", self.host, self.port))
|
||||
|
||||
def test_repr(self):
|
||||
self.assertEqual(repr(Mongo("test", self.host, self.port)),
|
||||
"Mongo(u'test', '%s', %s)" % (self.host, self.port))
|
||||
self.assertEqual(repr(Mongo("test", self.host, self.port).test),
|
||||
"Collection(Mongo(u'test', '%s', %s), u'test')" % (self.host, self.port))
|
||||
self.assertEqual(repr(Mongo("pymongo_test", self.host, self.port)),
|
||||
"Mongo(u'pymongo_test', '%s', %s)" % (self.host, self.port))
|
||||
self.assertEqual(repr(Mongo("pymongo_test", self.host, self.port).test),
|
||||
"Collection(Mongo(u'pymongo_test', '%s', %s), u'test')" % (self.host, self.port))
|
||||
|
||||
def test_save_find_one(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
db.test.remove({})
|
||||
|
||||
a_doc = SON({"hello": u"world"})
|
||||
@ -87,7 +87,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertEqual(count, 1)
|
||||
|
||||
def test_remove(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
db.test.remove({})
|
||||
|
||||
self.assertRaises(TypeError, db.test.remove, 5)
|
||||
@ -125,7 +125,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertFalse(db.test.find_one())
|
||||
|
||||
def test_save_a_bunch(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
db.test.remove({})
|
||||
|
||||
for i in xrange(1000):
|
||||
@ -143,7 +143,7 @@ class TestMongo(unittest.TestCase):
|
||||
break
|
||||
|
||||
def test_create_index(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
|
||||
self.assertRaises(TypeError, db.test.create_index, 5)
|
||||
self.assertRaises(TypeError, db.test.create_index, "hello")
|
||||
@ -153,35 +153,35 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertRaises(TypeError, db.test.create_index, "hello", "world")
|
||||
|
||||
db.test.drop_indexes()
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"test.test"}))
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"pymongo_test.test"}))
|
||||
|
||||
db.test.create_index("hello", ASCENDING)
|
||||
db.test.create_index([("hello", DESCENDING), ("world", ASCENDING)])
|
||||
|
||||
count = 0
|
||||
for _ in db.system.indexes.find({"ns": u"test.test"}):
|
||||
for _ in db.system.indexes.find({"ns": u"pymongo_test.test"}):
|
||||
count += 1
|
||||
self.assertEqual(count, 2)
|
||||
|
||||
db.test.drop_indexes()
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"test.test"}))
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"pymongo_test.test"}))
|
||||
db.test.create_index("hello", ASCENDING)
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"test.test"}),
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"pymongo_test.test"}),
|
||||
SON([(u"name", u"hello_1"),
|
||||
(u"ns", u"test.test"),
|
||||
(u"ns", u"pymongo_test.test"),
|
||||
(u"key", SON([(u"hello", 1)]))]))
|
||||
|
||||
db.test.drop_indexes()
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"test.test"}))
|
||||
self.assertFalse(db.system.indexes.find_one({"ns": u"pymongo_test.test"}))
|
||||
db.test.create_index([("hello", DESCENDING), ("world", ASCENDING)])
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"test.test"}),
|
||||
self.assertEqual(db.system.indexes.find_one({"ns": u"pymongo_test.test"}),
|
||||
SON([(u"name", u"hello_-1_world_1"),
|
||||
(u"ns", u"test.test"),
|
||||
(u"ns", u"pymongo_test.test"),
|
||||
(u"key", SON([(u"hello", -1),
|
||||
(u"world", 1)]))]))
|
||||
|
||||
def test_limit(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
|
||||
self.assertRaises(TypeError, db.test.find().limit, None)
|
||||
self.assertRaises(TypeError, db.test.find().limit, "hello")
|
||||
@ -228,7 +228,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertRaises(InvalidOperation, a.limit, 5)
|
||||
|
||||
def test_skip(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
|
||||
self.assertRaises(TypeError, db.test.find().skip, None)
|
||||
self.assertRaises(TypeError, db.test.find().skip, "hello")
|
||||
@ -272,7 +272,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertRaises(InvalidOperation, a.skip, 5)
|
||||
|
||||
def test_sort(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
|
||||
self.assertRaises(TypeError, db.test.find().sort, 5)
|
||||
self.assertRaises(TypeError, db.test.find().sort, "hello")
|
||||
@ -322,7 +322,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertRaises(InvalidOperation, a.sort, "x", ASCENDING)
|
||||
|
||||
def test_count(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
db.test.remove({})
|
||||
|
||||
self.assertEqual(0, db.test.find().count())
|
||||
@ -347,7 +347,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertEqual(0, db.test.acollectionthatdoesntexist.find().count())
|
||||
|
||||
def test_deref(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
db.test.remove({})
|
||||
|
||||
self.assertRaises(TypeError, db.dereference, 5)
|
||||
@ -361,7 +361,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertEqual(obj, db.dereference(DBRef("test", key)))
|
||||
|
||||
def test_auto_deref(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
db.test.a.remove({})
|
||||
db.test.b.remove({})
|
||||
db.test.remove({})
|
||||
@ -377,10 +377,10 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertEqual(dbref, db.test.a.find_one()["b_obj"])
|
||||
self.assertEqual(a, db.dereference(db.test.a.find_one()["b_obj"]))
|
||||
|
||||
db = Mongo("test", self.host, self.port, {"auto_dereference": False})
|
||||
db = Mongo("pymongo_test", self.host, self.port, {"auto_dereference": False})
|
||||
self.assertEqual(dbref, db.test.a.find_one()["b_obj"])
|
||||
|
||||
db = Mongo("test", self.host, self.port, {"auto_dereference": True})
|
||||
db = Mongo("pymongo_test", self.host, self.port, {"auto_dereference": True})
|
||||
self.assertNotEqual(dbref, db.test.a.find_one()["b_obj"])
|
||||
self.assertEqual(a, db.test.a.find_one()["b_obj"])
|
||||
|
||||
@ -396,7 +396,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertEqual(dbref, db.test.find_one(key)["x"])
|
||||
|
||||
def test_auto_ref(self):
|
||||
db = Mongo("test", self.host, self.port)
|
||||
db = Mongo("pymongo_test", self.host, self.port)
|
||||
db.test.a.remove({})
|
||||
db.test.b.remove({})
|
||||
|
||||
@ -410,13 +410,13 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertEqual(b["ref?"], a)
|
||||
self.assertEqual(db.test.b.find_one(key)["ref?"], a)
|
||||
|
||||
db = Mongo("test", self.host, self.port, {"auto_reference": False})
|
||||
db = Mongo("pymongo_test", self.host, self.port, {"auto_reference": False})
|
||||
key = db.test.b.save(b)
|
||||
self.assertEqual(b["_ns"], "test.b")
|
||||
self.assertEqual(b["ref?"], a)
|
||||
self.assertEqual(db.test.b.find_one(key)["ref?"], a)
|
||||
|
||||
db = Mongo("test", self.host, self.port, {"auto_reference": True})
|
||||
db = Mongo("pymongo_test", self.host, self.port, {"auto_reference": True})
|
||||
key = db.test.b.save(b)
|
||||
self.assertEqual(b["_ns"], "test.b")
|
||||
self.assertEqual(b["ref?"], a)
|
||||
@ -424,7 +424,7 @@ class TestMongo(unittest.TestCase):
|
||||
self.assertEqual(db.dereference(db.test.b.find_one(key)["ref?"]), a)
|
||||
|
||||
def test_auto_ref_and_deref(self):
|
||||
db = Mongo("test", self.host, self.port, {"auto_reference": True, "auto_dereference": True})
|
||||
db = Mongo("pymongo_test", self.host, self.port, {"auto_reference": True, "auto_dereference": True})
|
||||
db.test.a.remove({})
|
||||
db.test.b.remove({})
|
||||
db.test.c.remove({})
|
||||
|
||||
@ -28,7 +28,7 @@ from test_connection import get_connection
|
||||
|
||||
class TestSONManipulator(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = Database(get_connection(), "test")
|
||||
self.db = Database(get_connection(), "pymongo_test")
|
||||
|
||||
def test_basic(self):
|
||||
manip = SONManipulator(self.db)
|
||||
|
||||
@ -32,7 +32,7 @@ class SaveAndFind(threading.Thread):
|
||||
|
||||
class TestThreads(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.db = get_connection().test
|
||||
self.db = get_connection().pymongo_test
|
||||
|
||||
def test_threading(self):
|
||||
self.db.test.remove({})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user