def test_wait_for_db_ready(self):
    'Test waiting for db when db is available'
    with patch('django.db.utils.ConnectionHandler.__getitem__') as gi:
        gi.return_value = True
        call_command('wait_for_db')
        self.assertEqual(gi.call_count, 1)
Test waiting for db when db is available
def test_wait_for_db_ready(self):
    
    with patch('django.db.utils.ConnectionHandler.__getitem__') as gi:
        gi.return_value = True
        call_command('wait_for_db')
        self.assertEqual(gi.call_count, 1)