示例#1
0
    def test_test(self):
        uri = utils.build_database_uri(testing=True,
                                       engine='sqlite',
                                       name='real_db',
                                       test_name=':memory:')

        assert uri == 'sqlite:///:memory:'
示例#2
0
    def test_user(self):
        uri = utils.build_database_uri(engine='postgresql',
                                       username='******',
                                       port=5432,
                                       name='example')

        assert uri == 'postgresql:///bob@localhost:5432/example'
示例#3
0
    def test_host_ip(self):
        uri = utils.build_database_uri(engine='postgresql',
                                       username='******',
                                       port=5432,
                                       hostname='::1',
                                       name='example')

        assert uri == 'postgresql:///bob@[::1]:5432/example'
示例#4
0
    def test_host(self):
        uri = utils.build_database_uri(engine='postgresql',
                                       username='******',
                                       port=5432,
                                       host='example.com',
                                       name='example')

        assert uri == 'postgresql:///[email protected]:5432/example'
示例#5
0
    def test_user_pass(self):
        uri = utils.build_database_uri(engine='postgresql',
                                       user='******',
                                       port=5432,
                                       name='example',
                                       **{'pass': '******'})

        assert uri == 'postgresql:///bob:b@localhost:5432/example'
示例#6
0
    def test_user(self):
        uri = utils.build_database_uri(
            engine='postgresql',
            username='******',
            port=5432,
            name='example')

        assert uri == 'postgresql:///bob@localhost:5432/example'
示例#7
0
    def test_user_pass(self):
        uri = utils.build_database_uri(
            engine='postgresql',
            user='******',
            port=5432,
            name='example', **{'pass': '******'})

        assert uri == 'postgresql:///bob:b@localhost:5432/example'
示例#8
0
    def test_test(self):
        uri = utils.build_database_uri(
            testing=True,
            engine='sqlite',
            name='real_db',
            test_name=':memory:')

        assert uri == 'sqlite:///:memory:'
示例#9
0
    def test_host_ip(self):
        uri = utils.build_database_uri(
            engine='postgresql',
            username='******',
            port=5432,
            hostname='::1',
            name='example')

        assert uri == 'postgresql:///bob@[::1]:5432/example'
示例#10
0
    def test_host(self):
        uri = utils.build_database_uri(
            engine='postgresql',
            username='******',
            port=5432,
            host='example.com',
            name='example')

        assert uri == 'postgresql:///[email protected]:5432/example'
示例#11
0
    def test_user_pass_test(self):
        uri = utils.build_database_uri(testing=True,
                                       engine='postgresql',
                                       test_engine='mysql',
                                       username='******',
                                       test_username='******',
                                       password='******',
                                       test_password='******',
                                       port=5432,
                                       test_port=1024,
                                       name='example')

        assert uri == 'mysql:///a:a@localhost:1024/test_example'
示例#12
0
    def test_user_pass_test(self):
        uri = utils.build_database_uri(
            testing=True,
            engine='postgresql',
            test_engine='mysql',
            username='******',
            test_username='******',
            password='******',
            test_password='******',
            port=5432,
            test_port=1024,
            name='example')

        assert uri == 'mysql:///a:a@localhost:1024/test_example'
示例#13
0
    def test_name(self):
        uri = utils.build_database_uri(engine='sqlite', name=':memory:')

        assert uri == 'sqlite:///:memory:'
示例#14
0
    def test_name(self):
        uri = utils.build_database_uri(
            engine='sqlite',
            name=':memory:')

        assert uri == 'sqlite:///:memory:'