示例#1
0
    def test_database_custom_class(self):
        class CustomDatabase(object):
            def __init__(self, thing, **kwargs):
                self.resource = thing

        server = aiocouchdb.v1.server.Server(self.url,
                                             database_class=CustomDatabase)

        result = yield from server.db('db')
        self.assert_request_called_with('HEAD', 'db')
        self.assertIsInstance(result, CustomDatabase)
        self.assertIsInstance(result.resource, aiocouchdb.client.Resource)
示例#2
0
    def test_database_custom_class(self):
        class CustomDatabase(object):
            def __init__(self, thing, **kwargs):
                self.resource = thing

        server = aiocouchdb.v1.server.Server(self.url,
                                             database_class=CustomDatabase)

        result = yield from server.db('db')
        self.assert_request_called_with('HEAD', 'db')
        self.assertIsInstance(result, CustomDatabase)
        self.assertIsInstance(result.resource, aiocouchdb.client.Resource)
示例#3
0
 def test_init_with_name_from_server(self):
     server = aiocouchdb.v1.server.Server()
     db = yield from server.db('foo')
     self.assertEqual(db.name, 'foo')
示例#4
0
 def test_init_with_name_from_server(self):
     server = aiocouchdb.v1.server.Server()
     db = yield from server.db('foo')
     self.assertEqual(db.name, 'foo')