aboutsummaryrefslogtreecommitdiffstats
path: root/aria/multivim-plugin/openstack_plugin_common/tests/test.py
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2017-08-10 06:48:03 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-10 06:48:03 +0000
commitb2356570d9aa82f9e8ea259f9e282499c98efcbc (patch)
treeebccf8677dcc645ef1c27a09a646acd013fb033e /aria/multivim-plugin/openstack_plugin_common/tests/test.py
parentd48b750fc08b11a758b4c71ac71fe6cd2a2437d3 (diff)
parent9981f55920a6f1c1f20396d42e35b075b22f6a8f (diff)
Merge "ARIA multivim plugin initial checkin"
Diffstat (limited to 'aria/multivim-plugin/openstack_plugin_common/tests/test.py')
-rw-r--r--aria/multivim-plugin/openstack_plugin_common/tests/test.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/aria/multivim-plugin/openstack_plugin_common/tests/test.py b/aria/multivim-plugin/openstack_plugin_common/tests/test.py
new file mode 100644
index 0000000000..13099292ca
--- /dev/null
+++ b/aria/multivim-plugin/openstack_plugin_common/tests/test.py
@@ -0,0 +1,40 @@
+import json
+import os
+
+from cloudify.context import BootstrapContext
+
+from cloudify.mocks import MockCloudifyContext
+
+
+RETRY_AFTER = 1
+# Time during which no retry could possibly happen.
+NO_POSSIBLE_RETRY_TIME = RETRY_AFTER / 2.0
+
+BOOTSTRAP_CONTEXTS_WITHOUT_PREFIX = (
+ {
+ },
+ {
+ 'resources_prefix': ''
+ },
+ {
+ 'resources_prefix': None
+ },
+)
+
+
+def set_mock_provider_context(ctx, provider_context):
+
+ def mock_provider_context(provider_name_unused):
+ return provider_context
+
+ ctx.get_provider_context = mock_provider_context
+
+
+def create_mock_ctx_with_provider_info(*args, **kw):
+ cur_dir = os.path.dirname(os.path.realpath(__file__))
+ full_file_name = os.path.join(cur_dir, 'provider-context.json')
+ with open(full_file_name) as f:
+ provider_context = json.loads(f.read())['context']
+ kw['provider_context'] = provider_context
+ kw['bootstrap_context'] = BootstrapContext(provider_context['cloudify'])
+ return MockCloudifyContext(*args, **kw)