Add missing unit test for goodness weigher

Add a unit test for goodness weigher to test unset goodness
function in host capabilities.

Change-Id: I67f86d065f2c740a7beef641250b0881cf63deaa
This commit is contained in:
Vipin Balachandran 2015-05-31 12:41:36 +05:30
parent 102f6cfff2
commit 5a948407ce
1 changed files with 13 additions and 0 deletions

View File

@ -24,6 +24,19 @@ class GoodnessWeigherTestCase(test.TestCase):
def setUp(self):
super(GoodnessWeigherTestCase, self).setUp()
def test_goodness_weigher_with_no_goodness_function(self):
weigher = goodness.GoodnessWeigher()
host_state = fakes.FakeHostState('host1', {
'host': 'host.example.com',
'capabilities': {
'foo': '50'
}
})
weight_properties = {}
weight = weigher._weigh_object(host_state, weight_properties)
self.assertEqual(0, weight)
def test_goodness_weigher_passing_host(self):
weigher = goodness.GoodnessWeigher()
host_state = fakes.FakeHostState('host1', {