From 1e29428db292a8d2c5a4c6492ab1407834081235 Mon Sep 17 00:00:00 2001 From: Shai Berger Date: Mon, 27 May 2013 18:34:31 +0300 Subject: [PATCH] Fixed #20013 -- A test for sqlall fails under Oracle --- tests/commands_sql/tests.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/commands_sql/tests.py b/tests/commands_sql/tests.py index 831e9a27c4..630ebd2472 100644 --- a/tests/commands_sql/tests.py +++ b/tests/commands_sql/tests.py @@ -46,7 +46,13 @@ class SQLCommandsTestCase(TestCase): def test_sql_all(self): app = models.get_app('commands_sql') output = sql_all(app, no_style(), connections[DEFAULT_DB_ALIAS]) - # PostgreSQL creates two indexes - self.assertIn(len(output), [2, 3]) self.assertTrue(output[0].startswith('CREATE TABLE')) - self.assertTrue(output[1].startswith('CREATE INDEX')) + if connections[DEFAULT_DB_ALIAS].vendor == 'oracle': + self.assertEqual(len(output), 4) # Oracle creates a table, a sequence, a trigger and an index + self.assertIn('CREATE SEQUENCE', output[1]) + self.assertIn('CREATE OR REPLACE TRIGGER', output[2]) + self.assertTrue(output[3].startswith('CREATE INDEX')) + else: + # PostgreSQL creates two indexes + self.assertIn(len(output), [2, 3]) + self.assertTrue(output[1].startswith('CREATE INDEX'))