From 1630061cca25960ca7abc6f05ce3f2a9f372c557 Mon Sep 17 00:00:00 2001 From: Yair Fried Date: Sun, 13 Oct 2013 15:57:13 +0300 Subject: [PATCH] Separate negative tests api/network/security_groups moved negative tests cases to a new file Change-Id: I24438d556231d80b21e033acc79da3a050bf31cb --- tempest/api/network/test_security_groups.py | 14 ------- .../network/test_security_groups_negative.py | 42 +++++++++++++++++++ 2 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 tempest/api/network/test_security_groups_negative.py diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py index 914dcff024..9218f0c64e 100644 --- a/tempest/api/network/test_security_groups.py +++ b/tempest/api/network/test_security_groups.py @@ -17,7 +17,6 @@ from tempest.api.network import base from tempest.common.utils import data_utils -from tempest import exceptions from tempest.test import attr @@ -124,19 +123,6 @@ class SecGroupTest(base.BaseNetworkTest): for rule in rule_list_body['security_group_rules']] self.assertIn(rule_create_body['security_group_rule']['id'], rule_list) - @attr(type=['negative', 'smoke']) - def test_show_non_existent_security_group(self): - non_exist_id = data_utils.rand_name('secgroup-') - self.assertRaises(exceptions.NotFound, self.client.show_security_group, - non_exist_id) - - @attr(type=['negative', 'smoke']) - def test_show_non_existent_security_group_rule(self): - non_exist_id = data_utils.rand_name('rule-') - self.assertRaises(exceptions.NotFound, - self.client.show_security_group_rule, - non_exist_id) - class SecGroupTestXML(SecGroupTest): _interface = 'xml' diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py new file mode 100644 index 0000000000..d321e23951 --- /dev/null +++ b/tempest/api/network/test_security_groups_negative.py @@ -0,0 +1,42 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2013 OpenStack Foundation +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from tempest.api.network import test_security_groups as base +from tempest import exceptions +from tempest.test import attr +import uuid + + +class NegativeSecGroupTest(base.SecGroupTest): + _interface = 'json' + + @attr(type=['negative', 'smoke']) + def test_show_non_existent_security_group(self): + non_exist_id = str(uuid.uuid4()) + self.assertRaises(exceptions.NotFound, self.client.show_security_group, + non_exist_id) + + @attr(type=['negative', 'smoke']) + def test_show_non_existent_security_group_rule(self): + non_exist_id = str(uuid.uuid4()) + self.assertRaises(exceptions.NotFound, + self.client.show_security_group_rule, + non_exist_id) + + +class NegativeSecGroupTestXML(NegativeSecGroupTest): + _interface = 'xml'