diff options
author | Tom Forbes <tom@tomforb.es> | 2020-07-12 13:59:57 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-12-15 11:25:46 +0100 |
commit | b5e12d490af3debca8c55ab3c1698189fdedbbdb (patch) | |
tree | 5fe3005ac567f3addf78b81ae033191e2fa642f4 /tests/admin_scripts | |
parent | b960e4ed722a04a9db0d35293f76e253eedf9126 (diff) | |
download | django-b5e12d490af3debca8c55ab3c1698189fdedbbdb.tar.gz |
Fixed #31007 -- Allowed specifying type of auto-created primary keys.
This also changes the default type of auto-created primary keys
for new apps and projects to BigAutoField.
Diffstat (limited to 'tests/admin_scripts')
-rw-r--r-- | tests/admin_scripts/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index a82f5be5ed..7a38306d17 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -61,6 +61,7 @@ class AdminScriptTestCase(SimpleTestCase): settings_file.write("%s\n" % extra) exports = [ 'DATABASES', + 'DEFAULT_AUTO_FIELD', 'ROOT_URLCONF', 'SECRET_KEY', ] @@ -2188,6 +2189,20 @@ class StartApp(AdminScriptTestCase): "won't replace conflicting files." ) + def test_template(self): + out, err = self.run_django_admin(['startapp', 'new_app']) + self.assertNoOutput(err) + app_path = os.path.join(self.test_dir, 'new_app') + self.assertIs(os.path.exists(app_path), True) + with open(os.path.join(app_path, 'apps.py')) as f: + content = f.read() + self.assertIn('class NewAppConfig(AppConfig)', content) + self.assertIn( + "default_auto_field = 'django.db.models.BigAutoField'", + content, + ) + self.assertIn("name = 'new_app'", content) + class DiffSettings(AdminScriptTestCase): """Tests for diffsettings management command.""" |