Exemplo n.º 1
0
    def test_max_notification_id_raises_programming_error_when_table_not_created(
            self):
        # Construct the recorder.
        recorder = PostgresApplicationRecorder(
            datastore=self.datastore, events_table_name="stored_events")

        # Select notifications without creating table.
        with self.assertRaises(ProgrammingError):
            recorder.max_notification_id()
Exemplo n.º 2
0
    def test_max_notification_id_raises_programming_error_when_sql_is_broken(
            self):
        # Construct the recorder.
        recorder = PostgresApplicationRecorder(
            datastore=self.datastore, events_table_name="stored_events")

        # Create table.
        recorder.create_table()

        # Select notifications with broken statement.
        recorder.max_notification_id_statement = "BLAH"
        with self.assertRaises(ProgrammingError):
            recorder.max_notification_id()
Exemplo n.º 3
0
    def test_raises_operational_error_when_selecting_fails(self):
        # Construct the recorder.
        recorder = PostgresApplicationRecorder(
            datastore=self.datastore, events_table_name="stored_events")

        with self.assertRaises(OperationalError):
            recorder.select_notifications(start=1, limit=1)

        with self.assertRaises(OperationalError):
            recorder.max_notification_id()
Exemplo n.º 4
0
 def create_recorder(self):
     recorder = PostgresApplicationRecorder(
         self.datastore, events_table_name="stored_events")
     recorder.create_table()
     return recorder
 def create_recorder(self) -> ApplicationRecorder:
     self.uris = tmpfile_uris()
     self.db_uri = next(self.uris)
     recorder = PostgresApplicationRecorder(self.datastore)
     recorder.create_table()
     return recorder