mirror of
https://github.com/sprockets/sprockets-postgres.git
synced 2024-11-14 03:00:19 +00:00
Merge pull request #8 from nvllsvm/fix_before_connect
Fix postgres_status before first connection attempt
This commit is contained in:
commit
3d7940ee9c
2 changed files with 14 additions and 1 deletions
|
@ -408,7 +408,8 @@ class ApplicationMixin:
|
|||
}
|
||||
|
||||
"""
|
||||
if not self._postgres_connected.is_set():
|
||||
if not self._postgres_connected or \
|
||||
not self._postgres_connected.is_set():
|
||||
return {
|
||||
'available': False,
|
||||
'pool_size': 0,
|
||||
|
|
12
tests.py
12
tests.py
|
@ -349,6 +349,18 @@ class TestCase(testing.SprocketsHttpTestCase):
|
|||
return self.app
|
||||
|
||||
|
||||
class PostgresStatusTestCase(asynctest.TestCase):
|
||||
|
||||
async def test_postgres_status_before_first_connection(self):
|
||||
app = Application()
|
||||
status = await app.postgres_status()
|
||||
self.assertEqual(
|
||||
status,
|
||||
{'available': False,
|
||||
'pool_size': 0,
|
||||
'pool_free': 0})
|
||||
|
||||
|
||||
class RequestHandlerMixinTestCase(TestCase):
|
||||
|
||||
def test_postgres_status(self):
|
||||
|
|
Loading…
Reference in a new issue