Skip to content

Commit

Permalink
Merge pull request #1384 from xliiv/fix/missing-default-pool
Browse files Browse the repository at this point in the history
Fixed getting name of default pool for vserv.
  • Loading branch information
xliiv committed Apr 22, 2015
2 parents f2bf6d4 + f8e295a commit 2834951
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions src/ralph/ui/tests/unit/test_others.py
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from django.test import TestCase

from ralph.discovery.tests.util import (
DeviceFactory,
LoadBalancerVirtualServerFactory,
)
from ralph.ui.views.common import _get_balancers


class TestAddresses(TestCase):

def test_got_balancers_when_no_default_pool(self):
lbvs = LoadBalancerVirtualServerFactory()
self.assertIsNone(lbvs.default_pool)
balancers = list(_get_balancers(lbvs.device))
self.assertIsNone(balancers[0]['pool'])
2 changes: 1 addition & 1 deletion src/ralph/ui/views/common.py
Expand Up @@ -147,7 +147,7 @@ def _get_balancers(dev):
).all():
yield {
'balancer': dev.name,
'pool': vserv.default_pool.name,
'pool': vserv.default_pool.name if vserv.default_pool else None,
'enabled': None,
'address': vserv.address.address,
'server': vserv.name,
Expand Down

0 comments on commit 2834951

Please sign in to comment.