Example #1
0
def test_from_uri():
    db = trombi.from_uri('http://1.2.3.4/foobar')
    assert isinstance(db.server, trombi.Server)
    eq(db.baseurl, 'http://1.2.3.4/foobar')
    eq(db.name, 'foobar')

    db = trombi.from_uri('http://1.2.3.4:1122/foobar/')
    assert isinstance(db.server, trombi.Server)
    eq(db.baseurl, 'http://1.2.3.4:1122/foobar')
    eq(db.name, 'foobar')
Example #2
0
def test_from_uri():
    db = trombi.from_uri('http://1.2.3.4/foobar')
    assert isinstance(db.server, trombi.Server)
    eq(db.baseurl, 'http://1.2.3.4/foobar')
    eq(db.name, 'foobar')

    db = trombi.from_uri('http://1.2.3.4:1122/foobar/')
    assert isinstance(db.server, trombi.Server)
    eq(db.baseurl, 'http://1.2.3.4:1122/foobar')
    eq(db.name, 'foobar')
Example #3
0
def test_custom_encoder_from_uri():
    db = trombi.from_uri('http://localhost:5984/testdb/',
                         json_encoder=DatetimeEncoder)
    json.dumps({'foo': datetime.now()}, cls=db._json_encoder)
Example #4
0
def test_custom_encoder_from_uri():
    db = trombi.from_uri('http://localhost:5984/testdb/',
                         json_encoder=DatetimeEncoder)
    json.dumps({'foo': datetime.now()}, cls=db._json_encoder)