Skip to content

Commit

Permalink
[REVERT] Remove test
Browse files Browse the repository at this point in the history
  • Loading branch information
RoAduran committed Aug 9, 2024
1 parent f1ff418 commit 9792127
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions integration_specs/postgresql_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,6 @@

TEST_TABLE = 'test_table'

# Set up the logger
logger = logging.getLogger()

def setup_logger():
logger.setLevel(logging.INFO)

log_stream = logging.StreamHandler()
log_stream.setLevel(logging.INFO)

formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
log_stream.setFormatter(formatter)
logger.addHandler(log_stream)

log_capture_string = io.StringIO()
log_stream.setStream(log_capture_string)

return log_stream

with description('PostgresClientTest') as self:
with before.each:

Expand All @@ -55,19 +37,6 @@ def setup_logger():
f"INSERT INTO {TEST_TABLE}(item, size, active, creation_date) VALUES(%s, %s, %s, %s);",
("item_b", 20, True, datetime.datetime.fromtimestamp(3700))
)

# Create a string IO to capture logs
self.log_capture_string = io.StringIO()

self.logger_stream = setup_logger()

# Redirect the stream to the string IO
self.logger_stream.setStream(self.log_capture_string)

with after.each:
logger.removeHandler(self.logger_stream)
self.log_capture_string.close()


with context('FEATURE: execute'):
with context('happy path'):
Expand Down Expand Up @@ -96,10 +65,7 @@ def setup_logger():
(1, 'item_a', 40, False, datetime.datetime.fromtimestamp(100)),
(2, 'item_b', 20, True, datetime.datetime.fromtimestamp(3700)),
]))

log_contents = self.log_capture_string.getvalue().split('\n')
expect(log_contents[1]).to(contain('SELECT * FROM test_table'))


with context('when counting rows'):
with it('returns number of rows'):

Expand Down

0 comments on commit 9792127

Please sign in to comment.