mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	[2.1.x] Fixed #29613 -- Fixed --keepdb on PostgreSQL if the database exists and the user can't create databases.
Regression ine776dd2db6. Thanks Tim Graham for the review. Backport of1a9cbf41a1from master
This commit is contained in:
		| @@ -89,7 +89,14 @@ class DatabaseCreationTests(SimpleTestCase): | ||||
|             creation._create_test_db(verbosity=0, autoclobber=False, keepdb=True) | ||||
|         # Simulate test database creation raising unexpected error | ||||
|         with self.patch_test_db_creation(self._execute_raise_permission_denied): | ||||
|             with self.assertRaises(SystemExit): | ||||
|                 creation._create_test_db(verbosity=0, autoclobber=False, keepdb=False) | ||||
|             with self.assertRaises(SystemExit): | ||||
|             with mock.patch.object(DatabaseCreation, '_database_exists', return_value=False): | ||||
|                 with self.assertRaises(SystemExit): | ||||
|                     creation._create_test_db(verbosity=0, autoclobber=False, keepdb=False) | ||||
|                 with self.assertRaises(SystemExit): | ||||
|                     creation._create_test_db(verbosity=0, autoclobber=False, keepdb=True) | ||||
|         # Simulate test database creation raising "insufficient privileges". | ||||
|         # An error shouldn't appear when keepdb is on and the database already | ||||
|         # exists. | ||||
|         with self.patch_test_db_creation(self._execute_raise_permission_denied): | ||||
|             with mock.patch.object(DatabaseCreation, '_database_exists', return_value=True): | ||||
|                 creation._create_test_db(verbosity=0, autoclobber=False, keepdb=True) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user