diff options
| author | Tim Graham <timograham@gmail.com> | 2014-12-26 13:56:08 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-01-17 10:16:06 -0500 |
| commit | 4aa089a9a9504c4a833eee8161be013206da5d15 (patch) | |
| tree | ebc7e23d3805c57d9f6a4fc75767b5e5046617a4 /tests | |
| parent | a420f83e7d2e446ca01ef7c13d30c2ef3e975e5c (diff) | |
Removed support for custom SQL per deprecation timeline.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_scripts/tests.py | 1 | ||||
| -rw-r--r-- | tests/bash_completion/tests.py | 2 | ||||
| -rw-r--r-- | tests/fixtures_model_package/models/__init__.py | 7 | ||||
| -rw-r--r-- | tests/fixtures_model_package/models/sql/book.sql | 2 | ||||
| -rw-r--r-- | tests/fixtures_model_package/sql/book.sql | 1 | ||||
| -rw-r--r-- | tests/fixtures_model_package/tests.py | 16 | ||||
| -rw-r--r-- | tests/initial_sql_regress/__init__.py | 0 | ||||
| -rw-r--r-- | tests/initial_sql_regress/models.py | 9 | ||||
| -rw-r--r-- | tests/initial_sql_regress/sql/simple.sql | 12 | ||||
| -rw-r--r-- | tests/initial_sql_regress/tests.py | 45 |
10 files changed, 1 insertions, 94 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index c0c14d5bc5..7ed840aaf5 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1386,7 +1386,6 @@ class CommandTypes(AdminScriptTestCase): out, err = self.run_manage(args) self.assertNoOutput(err) self.assertOutput(out, "Checks the entire Django project for potential problems.") - self.assertEqual(out.count('optional arguments'), 1) def test_color_style(self): style = color.no_style() diff --git a/tests/bash_completion/tests.py b/tests/bash_completion/tests.py index c43c0483b5..8b284389c0 100644 --- a/tests/bash_completion/tests.py +++ b/tests/bash_completion/tests.py @@ -78,7 +78,7 @@ class BashCompletionTests(unittest.TestCase): "Subcommands can be autocompleted" self._user_input('django-admin sql') output = self._run_autocomplete() - self.assertEqual(output, ['sql sqlall sqlclear sqlcustom sqldropindexes sqlflush sqlindexes sqlmigrate sqlsequencereset']) + self.assertEqual(output, ['sql sqlall sqlclear sqldropindexes sqlflush sqlindexes sqlmigrate sqlsequencereset']) def test_completed_subcommand(self): "Show option flags in case a subcommand is completed" diff --git a/tests/fixtures_model_package/models/__init__.py b/tests/fixtures_model_package/models/__init__.py index c48cfd451d..63d73f83f9 100644 --- a/tests/fixtures_model_package/models/__init__.py +++ b/tests/fixtures_model_package/models/__init__.py @@ -13,10 +13,3 @@ class Article(models.Model): class Meta: app_label = 'fixtures_model_package' ordering = ('-pub_date', 'headline') - - -class Book(models.Model): - name = models.CharField(max_length=100) - - class Meta: - ordering = ('name',) diff --git a/tests/fixtures_model_package/models/sql/book.sql b/tests/fixtures_model_package/models/sql/book.sql deleted file mode 100644 index 9b3918f4d7..0000000000 --- a/tests/fixtures_model_package/models/sql/book.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Deprecated search path for custom SQL -- remove in Django 1.9 -INSERT INTO fixtures_model_package_book (name) VALUES ('My Deprecated Book'); diff --git a/tests/fixtures_model_package/sql/book.sql b/tests/fixtures_model_package/sql/book.sql deleted file mode 100644 index 21b1d9465b..0000000000 --- a/tests/fixtures_model_package/sql/book.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO fixtures_model_package_book (name) VALUES ('My Book'); diff --git a/tests/fixtures_model_package/tests.py b/tests/fixtures_model_package/tests.py index 431bf8fa47..ef5adb3de8 100644 --- a/tests/fixtures_model_package/tests.py +++ b/tests/fixtures_model_package/tests.py @@ -4,7 +4,6 @@ import warnings from django.core import management from django.test import TestCase -from django.utils.six import StringIO from .models import Article @@ -66,18 +65,3 @@ class FixtureTestCase(TestCase): ], lambda a: a.headline, ) - - -class InitialSQLTests(TestCase): - - def test_custom_sql(self): - """ - #14300 -- Verify that custom_sql_for_model searches `app/sql` and not - `app/models/sql` (the old location will work until Django 1.9) - """ - out = StringIO() - management.call_command("sqlcustom", "fixtures_model_package", stdout=out) - output = out.getvalue() - self.assertIn("INSERT INTO fixtures_model_package_book (name) VALUES ('My Book')", output) - # value from deprecated search path models/sql (remove in Django 1.9) - self.assertIn("Deprecated Book", output) diff --git a/tests/initial_sql_regress/__init__.py b/tests/initial_sql_regress/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/initial_sql_regress/__init__.py +++ /dev/null diff --git a/tests/initial_sql_regress/models.py b/tests/initial_sql_regress/models.py deleted file mode 100644 index 146a7ea691..0000000000 --- a/tests/initial_sql_regress/models.py +++ /dev/null @@ -1,9 +0,0 @@ -""" -Regression tests for initial SQL insertion. -""" - -from django.db import models - - -class Simple(models.Model): - name = models.CharField(max_length=50) diff --git a/tests/initial_sql_regress/sql/simple.sql b/tests/initial_sql_regress/sql/simple.sql deleted file mode 100644 index c3edb11c5a..0000000000 --- a/tests/initial_sql_regress/sql/simple.sql +++ /dev/null @@ -1,12 +0,0 @@ --- a comment -INSERT INTO initial_sql_regress_simple (name) VALUES ('John'); -- another comment -INSERT INTO initial_sql_regress_simple (name) VALUES ('-- Comment Man'); -INSERT INTO initial_sql_regress_simple (name) VALUES ('Paul'); -INSERT INTO - initial_sql_regress_simple (name) VALUES ('Ringo'); -INSERT INTO initial_sql_regress_simple (name) VALUES ('George'); -INSERT INTO initial_sql_regress_simple (name) VALUES ('Miles O''Brien'); -INSERT INTO initial_sql_regress_simple (name) VALUES ('Semicolon;Man'); -INSERT INTO initial_sql_regress_simple (name) VALUES ('"100%" of % are not placeholders'); -INSERT INTO initial_sql_regress_simple (name) VALUES ('This line has a Windows line ending');
- diff --git a/tests/initial_sql_regress/tests.py b/tests/initial_sql_regress/tests.py deleted file mode 100644 index ebbe36d35d..0000000000 --- a/tests/initial_sql_regress/tests.py +++ /dev/null @@ -1,45 +0,0 @@ -from django.core.management.color import no_style -from django.core.management.sql import custom_sql_for_model -from django.db import connections, DEFAULT_DB_ALIAS -from django.test import TestCase, override_settings - -from .models import Simple - - -class InitialSQLTests(TestCase): - """ - The format of the included SQL file for this test suite is important. - It must end with a trailing newline in order to test the fix for #2161. - """ - - def test_initial_sql(self): - """ - As pointed out by #14661, test data loaded by custom SQL - can't be relied upon; as a result, the test framework flushes the - data contents before every test. This test validates that this has - occurred. - """ - self.assertEqual(Simple.objects.count(), 0) - - def test_custom_sql(self): - """ - Simulate the custom SQL loading by migrate. - """ - connection = connections[DEFAULT_DB_ALIAS] - custom_sql = custom_sql_for_model(Simple, no_style(), connection) - with connection.cursor() as cursor: - for sql in custom_sql: - cursor.execute(sql) - self.assertEqual(Simple.objects.count(), 9) - self.assertEqual( - Simple.objects.get(name__contains='placeholders').name, - '"100%" of % are not placeholders' - ) - - @override_settings(DEBUG=True) - def test_custom_sql_debug(self): - """ - Same test, ensure that CursorDebugWrapper doesn't alter sql loading - (#3485). - """ - self.test_custom_sql() |
