Add some security group tests for the V1_1 API

This patch adds a test for NoUniqueMatch exception
to the v1_1 API

Change-Id: Ic9947eaed34be100c529f021432f0c388a7c3ddb
Closes-Bug: #1250501
This commit is contained in:
Abhishek Chanda 2013-12-13 20:34:25 +05:30
parent e6a51f47c4
commit a20284ebe8
1 changed files with 12 additions and 0 deletions

View File

@ -2063,3 +2063,15 @@ class GetSecgroupTest(utils.TestCase):
novaclient.v1_1.shell._get_secgroup,
cs,
'abc')
def test_with_non_unique_name(self):
group_one = mock.MagicMock()
group_one.name = 'group_one'
cs = mock.Mock(**{
'security_groups.get.return_value': 'sec_group',
'security_groups.list.return_value': [group_one, group_one],
})
self.assertRaises(exceptions.NoUniqueMatch,
novaclient.v1_1.shell._get_secgroup,
cs,
'group_one')