summaryrefslogtreecommitdiffstats
path: root/aria/multivim-plugin/neutron_plugin/tests/test_security_group.py
diff options
context:
space:
mode:
authordfilppi <dewayne@cloudify.co>2017-08-31 00:15:51 +0000
committerDeWayne Filppi <dewayne@cloudify.co>2017-09-07 16:37:00 +0000
commitdf40f6f09f11aa823c1fd07e85887885f20d356b (patch)
treec5d186d21602ad4464e0b7ec6cc8618d9a7a8f54 /aria/multivim-plugin/neutron_plugin/tests/test_security_group.py
parentdcb890a6fa153900a0562872ccc31a5df2dffd24 (diff)
reorg and add pom build for wheel
Change-Id: Iab761e263f1e2380471dd38c2b7ce9b77f0aab0e Signed-off-by: DeWayne Filppi <dewayne@cloudify.co> Issue-id: SO-106
Diffstat (limited to 'aria/multivim-plugin/neutron_plugin/tests/test_security_group.py')
-rw-r--r--aria/multivim-plugin/neutron_plugin/tests/test_security_group.py115
1 files changed, 0 insertions, 115 deletions
diff --git a/aria/multivim-plugin/neutron_plugin/tests/test_security_group.py b/aria/multivim-plugin/neutron_plugin/tests/test_security_group.py
deleted file mode 100644
index e958cddb33..0000000000
--- a/aria/multivim-plugin/neutron_plugin/tests/test_security_group.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# -*- coding: utf-8 -*-
-#########
-# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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.
-
-import unittest
-
-from mock import Mock, patch
-from requests.exceptions import RequestException
-
-from neutron_plugin import security_group
-
-from cloudify.exceptions import NonRecoverableError
-from cloudify.state import current_ctx
-
-from cloudify.mocks import MockCloudifyContext
-
-
-class FakeException(Exception):
- pass
-
-
-@patch('openstack_plugin_common.OpenStackClient._validate_auth_params')
-@patch('openstack_plugin_common.NeutronClientWithSugar')
-class TestSecurityGroup(unittest.TestCase):
-
- def setUp(self):
- super(TestSecurityGroup, self).setUp()
- self.nova_client = Mock()
-
- self.ctx = MockCloudifyContext(
- node_id='test',
- deployment_id='test',
- properties={
- 'description': 'The best Security Group. Great',
- 'rules': [],
- 'resource_id': 'mock_sg',
- 'security_group': {
- },
- 'server': {},
- 'openstack_config': {
- 'auth_url': 'things/v3',
- },
- },
- operation={'retry_number': 0},
- provider_context={'resources': {}}
- )
- current_ctx.set(self.ctx)
- self.addCleanup(current_ctx.clear)
-
- findctx = patch(
- 'openstack_plugin_common._find_context_in_kw',
- return_value=self.ctx,
- )
- findctx.start()
- self.addCleanup(findctx.stop)
-
- def test_set_sg_runtime_properties(self, mock_nc, *_):
- security_group.create(
- nova_client=self.nova_client,
- ctx=self.ctx,
- args={},
- )
-
- self.assertEqual(
- {
- 'external_type': 'security_group',
- 'external_id': mock_nc().get_id_from_resource(),
- 'external_name': mock_nc().get_name_from_resource(),
- },
- self.ctx.instance.runtime_properties
- )
-
- def test_create_sg_wait_timeout(self, mock_nc, *_):
- mock_nc().show_security_group.side_effect = RequestException
-
- with self.assertRaises(NonRecoverableError):
- security_group.create(
- nova_client=self.nova_client,
- ctx=self.ctx,
- args={},
- status_attempts=3,
- status_timeout=0.001,
- )
-
- @patch(
- 'neutron_plugin.security_group.delete_resource_and_runtime_properties')
- def test_dont_duplicate_if_failed_rule(self, mock_del_res, mock_nc, *_):
- self.ctx.node.properties['rules'] = [
- {
- 'port': '🍷',
- },
- ]
- mock_nc().create_security_group_rule.side_effect = FakeException
- mock_del_res.side_effect = FakeException('the 2nd')
-
- with self.assertRaises(NonRecoverableError) as e:
- security_group.create(
- nova_client=self.nova_client,
- ctx=self.ctx,
- args={},
- )
-
- self.assertIn('the 2nd', str(e.exception))