diff --git a/trac/tests/functional/tester.py b/trac/tests/functional/tester.py index f4ddac093f..ef405a3909 100755 --- a/trac/tests/functional/tester.py +++ b/trac/tests/functional/tester.py @@ -423,6 +423,7 @@ def create_report(self, title, query, description): tc.formvalue('edit_report', 'query', query) tc.submit() tc.notfind(internal_error) + tc.find(r'>\s*The report has been created\.\s*<') url = b.get_url() reportnum = None diff --git a/trac/ticket/tests/functional/main.py b/trac/ticket/tests/functional/main.py index 2738bc6769..4b4cdcec0f 100755 --- a/trac/ticket/tests/functional/main.py +++ b/trac/ticket/tests/functional/main.py @@ -690,6 +690,18 @@ def runTest(self): class TestNewReport(FunctionalTestCaseSetup): def runTest(self): """Create a new report""" + env = self._testenv.get_trac_environment() + schema = env.config.get('trac', 'database').split(':', 1)[0] + if schema == 'sqlite': + delta_days = "julianday('now') - " \ + "julianday(changetime / 1000000, 'unixepoch')" + elif schema == 'postgres': + delta_days = \ + "(date_part('epoch', now()) - changetime / 1000000) / 86400" + elif schema == 'mysql': + delta_days = "(unix_timestamp() - changetime / 1000000) / 86400" + else: + raise AssertionError(repr(schema)) self._tester.create_report( 'Closed tickets, modified in the past 7 days by owner.', """ SELECT DISTINCT p.value AS __color__, @@ -698,18 +710,16 @@ def runTest(self): reporter, time AS created, changetime AS modified, t.description AS _description, priority, - round(julianday('now') - - julianday(changetime, 'unixepoch')) as days, + round({delta_days}) as days, resolution, owner as __group__ FROM ticket t LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' - WHERE ((julianday('now') - - julianday(changetime, 'unixepoch')) < 7) + WHERE {delta_days} < 7 AND status = 'closed' ORDER BY __group__, changetime, p.value - """, + """.format(delta_days=delta_days), 'List of all tickets that are closed, and have been modified in' ' the past 7 days, grouped by owner.\n\n(So they have probably' ' been closed this week.)')