def __init__(self, db_settings=None, db_backup_name=None):
"""
Constructor
Args:
db_settings (dict): A dict of database settings
db_backup_name (str): The name that will be given to the backup database
"""
self.db_settings = db_settings or settings.DATABASES['default']
self.db_name = self.db_settings['NAME']
if self.db_name[0:5] != 'test_':
raise Exception(
"The test suite is attempting to use the database '{}'."
"The test database should have a name that begins with 'test_'. Exiting...".format(self.db_name)
)
self.db_backup_name = db_backup_name or getattr(settings, 'BACKUP_DB_NAME', self.DEFAULT_BACKUP_DB_NAME)
self.db_cmd_args = [
"-h", self.db_settings['HOST'],
"-p", str(self.db_settings['PORT']),
"-U", self.db_settings['USER']
]
评论列表
文章目录