Example #1
0
class TestPostgresEventStore(unittest.TestCase, BaseTestEventStore):

    def setUp(self):
        self._conn = psycopg2.connect("dbname=postgres user=zentral_testing")
        self._conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
        with self._conn:
            with self._conn.cursor() as cur:
                cur.execute('CREATE DATABASE zentral_testing')
        self.event_store = PostgresEventStore({'database': 'zentral_testing',
                                               'user': '******',
                                               'store_name': 'postgres_test'})

    def tearDown(self):
        self.event_store.close()
        with self._conn:
            with self._conn.cursor() as cur:
                cur.execute('DROP DATABASE zentral_testing')
Example #2
0
 def setUp(self):
     self._conn = psycopg2.connect("dbname=postgres user=zentral_testing")
     self._conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
     with self._conn:
         with self._conn.cursor() as cur:
             cur.execute('CREATE DATABASE zentral_testing')
     self.event_store = PostgresEventStore({'database': 'zentral_testing',
                                            'user': '******',
                                            'store_name': 'postgres_test'})
Example #3
0
class TestPostgresEventStore(unittest.TestCase, BaseTestEventStore):

    def setUp(self):
        # use the django default test db
        store_settings = {'database': 'test_{}'.format(os.environ.get('POSTGRES_DB', 'zentral')),
                          'user': os.environ.get('POSTGRES_USER', 'zentral'),
                          'store_name': 'postgres_test'}
        host = os.environ.get('POSTGRES_HOST')
        if host:
            store_settings['host'] = host
        password = os.environ.get('POSTGRES_PASSWORD')
        if password:
            store_settings['password'] = password
        self.event_store = PostgresEventStore(store_settings)
        self.event_store.wait_and_configure()

    def tearDown(self):
        self.event_store.close()
Example #4
0
class TestPostgresEventStore(unittest.TestCase, BaseTestEventStore):

    def setUp(self):
        # use the django default test db
        store_settings = {'database': 'test_{}'.format(os.environ.get('POSTGRES_DB', 'zentral')),
                          'user': os.environ.get('POSTGRES_USER', 'zentral'),
                          'store_name': 'postgres_test'}
        host = os.environ.get('POSTGRES_HOST')
        if host:
            store_settings['host'] = host
        password = os.environ.get('POSTGRES_PASSWORD')
        if password:
            store_settings['password'] = password
        self.event_store = PostgresEventStore(store_settings)

    def tearDown(self):
        with self.event_store._conn:
            with self.event_store._conn.cursor() as cur:
                cur.execute("delete from events *;")
        self.event_store.close()
Example #5
0
 def setUp(self):
     # use the django default test db
     store_settings = {'database': 'test_{}'.format(os.environ.get('POSTGRES_DB', 'zentral')),
                       'user': os.environ.get('POSTGRES_USER', 'zentral'),
                       'store_name': 'postgres_test'}
     host = os.environ.get('POSTGRES_HOST')
     if host:
         store_settings['host'] = host
     password = os.environ.get('POSTGRES_PASSWORD')
     if password:
         store_settings['password'] = password
     self.event_store = PostgresEventStore(store_settings)
Example #6
0
class TestPostgresEventStore(unittest.TestCase, BaseTestEventStore):
    def setUp(self):
        # use the django default test db
        store_settings = {
            'database':
            'test_{}'.format(os.environ.get('POSTGRES_DB', 'zentral')),
            'user': os.environ.get('POSTGRES_USER', 'zentral'),
            'store_name': 'postgres_test'
        }
        host = os.environ.get('POSTGRES_HOST')
        if host:
            store_settings['host'] = host
        password = os.environ.get('POSTGRES_PASSWORD')
        if password:
            store_settings['password'] = password
        self.event_store = PostgresEventStore(store_settings)

    def tearDown(self):
        with self.event_store._conn:
            with self.event_store._conn.cursor() as cur:
                cur.execute("delete from events *;")
        self.event_store.close()
Example #7
0
 def setUp(self):
     # use the django default test db
     store_settings = {
         'database':
         'test_{}'.format(os.environ.get('POSTGRES_DB', 'zentral')),
         'user': os.environ.get('POSTGRES_USER', 'zentral'),
         'store_name': 'postgres_test'
     }
     host = os.environ.get('POSTGRES_HOST')
     if host:
         store_settings['host'] = host
     password = os.environ.get('POSTGRES_PASSWORD')
     if password:
         store_settings['password'] = password
     self.event_store = PostgresEventStore(store_settings)