From a20284ebe8973beb5f80bb54458c2c817e184c42 Mon Sep 17 00:00:00 2001 From: Abhishek Chanda Date: Fri, 13 Dec 2013 20:34:25 +0530 Subject: [PATCH] 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 --- novaclient/tests/v1_1/test_shell.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/novaclient/tests/v1_1/test_shell.py b/novaclient/tests/v1_1/test_shell.py index 38c721552..083d6cf5a 100644 --- a/novaclient/tests/v1_1/test_shell.py +++ b/novaclient/tests/v1_1/test_shell.py @@ -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')