﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24791	Cannot run tests without access to postgres database	Daniel Hahler	nobody	"The change for ticket #16969 prevents Django from being able to run tests on Heroku, 
here you are not allowed to connect to the ""postgres"" database, at least with the free tier.

Would it be an option to use an explicitly configured
`DATABASES['default']['TEST']['NAME']` setting, instead of 'postgres' here?

Or could there be a new setting, like
`DATABASES['default']['TEST']['CONNECT_NAME']`?


The traceback, for reference (Django 1.8.1):

    {{{
    .heroku/python/lib/python2.7/site-packages/pytest_django/fixtures.py:53: 
    >           db_cfg = setup_databases(verbosity=0, interactive=False)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    .heroku/python/lib/python2.7/site-packages/django/test/runner.py:370: in setup_databases
        serialize=connection.settings_dict.get(""TEST"", {}).get(""SERIALIZE"", True),
    .heroku/python/lib/python2.7/site-packages/django/db/backends/base/creation.py:354: in create_test_db
        self._create_test_db(verbosity, autoclobber, keepdb)
    .heroku/python/lib/python2.7/site-packages/django/db/backends/base/creation.py:447: in _create_test_db
        with self._nodb_connection.cursor() as cursor:
    .heroku/python/lib/python2.7/site-packages/django/db/backends/base/base.py:164: in cursor
        cursor = self.make_cursor(self._cursor())
    .heroku/python/lib/python2.7/site-packages/django/db/backends/base/base.py:135: in _cursor
        self.ensure_connection()
    .heroku/python/lib/python2.7/site-packages/django/db/backends/base/base.py:130: in ensure_connection
        self.connect()
    .heroku/python/lib/python2.7/site-packages/django/db/utils.py:97: in __exit__
        six.reraise(dj_exc_type, dj_exc_value, traceback)
    .heroku/python/lib/python2.7/site-packages/django/db/backends/base/base.py:130: in ensure_connection
        self.connect()
    .heroku/python/lib/python2.7/site-packages/django/db/backends/base/base.py:119: in connect
        self.connection = self.get_new_connection(conn_params)
    .heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py:172: in get_new_connection
        connection = Database.connect(**conn_params)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
        ...

            if dsn is None:
                if not items:
                    raise TypeError('missing dsn and no parameters')
                else:
                    dsn = "" "".join([""%s=%s"" % (k, _param_escape(str(v)))
                        for (k, v) in items])

    >       conn = _connect(dsn, connection_factory=connection_factory, async=async)
    E       OperationalError: FATAL:  permission denied for database ""postgres""
    E       DETAIL:  User does not have CONNECT privilege.
    
    .heroku/python/lib/python2.7/site-packages/psycopg2/__init__.py:164: OperationalError
    }}}
"	Bug	closed	Testing framework	1.8	Release blocker	fixed		django@…	Ready for checkin	1	0	0	0	0	0
