class TestDatabase(unittest.TestCase): def setUp(self): self.db = Database(HOST, PORT, DB_NAME) self.db.mongo_database["my_capped_collection"].drop() def test_alive(self): assert_that(self.db.alive(), is_(True)) def test_getting_a_repository(self): repository = self.db.get_repository('my_bucket') assert_that(repository, instance_of(Repository)) def test_getting_a_collection(self): collection = self.db.get_collection('my_collection') assert_that(collection, instance_of(MongoDriver)) def test_create_capped_collection(self): self.db.create_capped_collection("my_capped_collection", 1234) assert_that(self.db.mongo_database["my_capped_collection"].options(), is_({"capped": True, "size": 1234})) def test_get_collection_names(self): self.db.create_capped_collection("foo", 1234) assert_that('foo', is_in(self.db.collection_names()))
class TestDatabase(unittest.TestCase): def setUp(self): self.db = Database('localhost', 27017, 'backdrop_test') def test_alive(self): assert_that(self.db.alive(), is_(True)) def test_getting_a_repository(self): repository = self.db.get_repository('my_bucket') assert_that(repository, instance_of(Repository))