Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
boxed committed Nov 3, 2023
1 parent ff6d85b commit c9b51ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion iommi/sql_trace__tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os
import re
from datetime import (
date,
Expand Down Expand Up @@ -59,6 +60,8 @@ def test_middleware(settings, client, caplog):
settings.SQL_DEBUG_WORST_SUSPICIOUS_CUTOFF = 0
settings.SQL_DEBUG_WORST_QUERY_CUTOFF = 1

base_path = str(Path(__file__).parent.parent.parent) + os.path.sep

with time_machine.travel('1948, 2, 19', tick=False):
client.get('/no_queries/?_iommi_sql_trace')
assert 'GET /no_queries/?_iommi_sql_trace -> 200 (0.000s)' in caplog.text
Expand All @@ -80,7 +83,7 @@ def test_middleware(settings, client, caplog):
assert select_statement in caplog.text
assert 'File "iommi/sql_trace__tests.py", line ' in caplog.text.replace('iommi/iommi/', 'iommi/').replace(
'./', ''
)
).replace(base_path, '')
assert re.findall(r'GET /\?_iommi_sql_trace -> 200 \(0\.\d\d\ds\) \(sql time: 0\.\d\d\ds\)', caplog.text)
assert '... and 3 more unique statements' in caplog.text

Expand Down

0 comments on commit c9b51ca

Please sign in to comment.