Exemple #1
0
 def test_unicode_value(self, monkeypatch):
     port = portend.find_available_local_port()
     monkeypatch.setitem(os.environ, 'LANG', 'C')
     server = PostgresServer(HOST, port)
     server.initdb()
     try:
         server.start()
         server.get_version()
         db = server.create('test_unicode')
         db.sql('CREATE TABLE records(name varchar(80))')
         db.sql("INSERT INTO records (name) VALUES (U&'\\2609')")
     finally:
         server.destroy()
Exemple #2
0
    def test_serves_postgres_with_locale(self):
        port = portend.find_available_local_port()
        server = PostgresServer(HOST, port)
        locale = 'C'
        server.initdb(locale=locale)

        try:
            server.start()
            server.get_version()  # To check we're able to talk to it.

            config = os.path.join(server.base_pathname, 'postgresql.conf')
            with io.open(config, encoding='utf-8') as strm:
                expect = "lc_messages = 'C'"
                assert any(expect in line for line in strm)
        finally:
            server.destroy()
Exemple #3
0
    def test_serves_postgres(self):
        port = portend.find_available_local_port()
        server = PostgresServer(HOST, port)
        server.initdb()

        try:
            server.start()
            version = server.get_version()

            assert len(version) > 0
            assert version[0] >= 8
        finally:
            server.destroy()