1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
|
Description: Remove network access unit tests
These tests are doing network access, which is forbidden by policy. This patch
removes them so we can still run unit tests at build time.
Author: Thomas Goirand <zigo@debian.org>
Bug-Debian: https://bugs.debian.org/908391
Forwarded: no
Last-Update: 2018-09-10
--- python-tosca-parser-1.1.0.orig/toscaparser/tests/test_prereq.py
+++ python-tosca-parser-1.1.0/toscaparser/tests/test_prereq.py
@@ -40,15 +40,6 @@ class CSARPrereqTest(TestCase):
error = self.assertRaises(ValidationError, csar.validate)
self.assertEqual(_('"%s" is not a valid zip file.') % path, str(error))
- def test_url_is_zip(self):
- path = "https://github.com/openstack/tosca-parser/raw/master/" \
- "toscaparser/tests/data/CSAR/csar_not_zip.zip"
- csar = CSAR(path, False)
- error = self.assertRaises(ValidationError, csar.validate)
- self.assertEqual(_('"%s" is not a valid zip file.') % path, str(error))
- self.assertTrue(csar.temp_dir is None or
- not os.path.exists(csar.temp_dir))
-
def test_metadata_file_exists(self):
path = os.path.join(self.base_path,
"data/CSAR/csar_no_metadata_file.zip")
@@ -113,20 +104,6 @@ class CSARPrereqTest(TestCase):
self.assertTrue(csar.temp_dir is None or
not os.path.exists(csar.temp_dir))
- def test_csar_invalid_import_url(self):
- path = os.path.join(self.base_path,
- "data/CSAR/csar_wordpress_invalid_import_url.zip")
- csar = CSAR(path)
- error = self.assertRaises(URLException, csar.validate)
- self.assertEqual(_('Failed to reach server '
- '"https://raw.githubusercontent.com/openstack/'
- 'tosca-parser/master/toscaparser/tests/data/CSAR/'
- 'tosca_single_instance_wordpress/Definitions/'
- 'wordpress1.yaml". Reason is: Not Found.'),
- str(error))
- self.assertTrue(csar.temp_dir is None or
- not os.path.exists(csar.temp_dir))
-
def test_csar_invalid_script_path(self):
path = os.path.join(self.base_path,
"data/CSAR/csar_wordpress_invalid_script_path.zip")
@@ -159,14 +136,6 @@ class CSARPrereqTest(TestCase):
csar = CSAR(path)
self.assertTrue(csar.validate())
self.assertTrue(csar.temp_dir is None or
- not os.path.exists(csar.temp_dir))
-
- def test_valid_csar_with_url_import_and_script(self):
- path = os.path.join(self.base_path, "data/CSAR/csar_wordpress_with_url"
- "_import_and_script.zip")
- csar = CSAR(path)
- self.assertTrue(csar.validate())
- self.assertTrue(csar.temp_dir is None or
not os.path.exists(csar.temp_dir))
def test_metadata_invalid_csar(self):
--- python-tosca-parser-1.1.0.orig/toscaparser/tests/test_toscatpl.py
+++ python-tosca-parser-1.1.0/toscaparser/tests/test_toscatpl.py
@@ -257,18 +257,6 @@ class ToscaTemplateTest(TestCase):
expected_hosts,
sorted([v.type for v in node_tpl.relationships.values()]))
- def test_repositories(self):
- template = ToscaTemplate(self.tosca_repo_tpl)
- self.assertEqual(
- ['repo_code0', 'repo_code1', 'repo_code2'],
- sorted([input.name for input in template.repositories]))
-
- input_name = "repo_code2"
- expected_url = "https://github.com/nandinivemula/intern/master"
- for input in template.repositories:
- if input.name == input_name:
- self.assertEqual(input.url, expected_url)
-
def test_template_macro(self):
template = ToscaTemplate(self.tosca_elk_tpl)
for node_tpl in template.nodetemplates:
@@ -448,67 +436,6 @@ class ToscaTemplateTest(TestCase):
tosca = ToscaTemplate(tosca_tpl, parsed_params=params)
self.assertTrue(tosca.topology_template.custom_defs)
- def test_local_template_with_url_import(self):
- tosca_tpl = os.path.join(
- os.path.dirname(os.path.abspath(__file__)),
- "data/tosca_single_instance_wordpress_with_url_import.yaml")
- tosca = ToscaTemplate(tosca_tpl,
- parsed_params={'db_root_pwd': '123456'})
- self.assertTrue(tosca.topology_template.custom_defs)
-
- def test_url_template_with_local_relpath_import(self):
- tosca_tpl = ('https://raw.githubusercontent.com/openstack/'
- 'tosca-parser/master/toscaparser/tests/data/'
- 'tosca_single_instance_wordpress.yaml')
- tosca = ToscaTemplate(tosca_tpl, a_file=False,
- parsed_params={"db_name": "mysql",
- "db_user": "mysql",
- "db_root_pwd": "1234",
- "db_pwd": "5678",
- "db_port": 3306,
- "cpus": 4})
- self.assertTrue(tosca.topology_template.custom_defs)
-
- def test_url_template_with_local_abspath_import(self):
- tosca_tpl = ('https://raw.githubusercontent.com/openstack/'
- 'tosca-parser/master/toscaparser/tests/data/'
- 'tosca_single_instance_wordpress_with_local_abspath_'
- 'import.yaml')
- self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl,
- None, False)
- err_msg = (_('Absolute file name "/tmp/tosca-parser/toscaparser/tests'
- '/data/custom_types/wordpress.yaml" cannot be used in a '
- 'URL-based input template "%(tpl)s".')
- % {'tpl': tosca_tpl})
- exception.ExceptionCollector.assertExceptionMessage(ImportError,
- err_msg)
-
- def test_url_template_with_url_import(self):
- tosca_tpl = ('https://raw.githubusercontent.com/openstack/'
- 'tosca-parser/master/toscaparser/tests/data/'
- 'tosca_single_instance_wordpress_with_url_import.yaml')
- tosca = ToscaTemplate(tosca_tpl, a_file=False,
- parsed_params={"db_root_pwd": "1234"})
- self.assertTrue(tosca.topology_template.custom_defs)
-
- def test_csar_parsing_wordpress(self):
- csar_archive = os.path.join(
- os.path.dirname(os.path.abspath(__file__)),
- 'data/CSAR/csar_wordpress.zip')
- self.assertTrue(ToscaTemplate(csar_archive,
- parsed_params={"db_name": "mysql",
- "db_user": "mysql",
- "db_root_pwd": "1234",
- "db_pwd": "5678",
- "db_port": 3306,
- "cpus": 4}))
-
- def test_csar_parsing_elk_url_based(self):
- csar_archive = ('https://github.com/openstack/tosca-parser/raw/master/'
- 'toscaparser/tests/data/CSAR/csar_elk.zip')
- self.assertTrue(ToscaTemplate(csar_archive, a_file=False,
- parsed_params={"my_cpus": 4}))
-
def test_nested_imports_in_templates(self):
tosca_tpl = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
@@ -666,21 +593,6 @@ class ToscaTemplateTest(TestCase):
self.assertEqual(tosca.version, "tosca_simple_yaml_1_0")
- def test_yaml_dict_tpl_with_params_and_url_import(self):
- test_tpl = os.path.join(
- os.path.dirname(os.path.abspath(__file__)),
- "data/tosca_single_instance_wordpress_with_url_import.yaml")
-
- yaml_dict_tpl = toscaparser.utils.yamlparser.load_yaml(test_tpl)
-
- params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user',
- 'db_root_pwd': 'mypasswd'}
-
- tosca = ToscaTemplate(parsed_params=params,
- yaml_dict_tpl=yaml_dict_tpl)
-
- self.assertEqual(tosca.version, "tosca_simple_yaml_1_0")
-
def test_yaml_dict_tpl_with_rel_import(self):
test_tpl = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
@@ -813,12 +725,6 @@ class ToscaTemplateTest(TestCase):
"data/test_attributes_inheritance.yaml")
ToscaTemplate(tosca_tpl)
- def test_repositories_definition(self):
- tosca_tpl = os.path.join(
- os.path.dirname(os.path.abspath(__file__)),
- "data/repositories/test_repositories_definition.yaml")
- ToscaTemplate(tosca_tpl)
-
def test_custom_caps_def(self):
tosca_tpl = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
--- python-tosca-parser-1.1.0.orig/toscaparser/tests/test_toscatplvalidation.py
+++ python-tosca-parser-1.1.0/toscaparser/tests/test_toscatplvalidation.py
@@ -326,35 +326,6 @@ class ToscaTemplateValidationTest(TestCa
tpl_snippet, path, None)
self.assertEqual(errormsg, err.__str__())
- def test_imports_without_import_name(self):
- tpl_snippet = '''
- imports:
- - custom_types/paypalpizzastore_nodejs_app.yaml
- - https://raw.githubusercontent.com/openstack/\
-tosca-parser/master/toscaparser/tests/data/custom_types/wordpress.yaml
- '''
- path = 'toscaparser/tests/data/tosca_elk.yaml'
- custom_defs = self._imports_content_test(tpl_snippet,
- path,
- "node_types")
- self.assertTrue(custom_defs)
-
- def test_imports_wth_import_name(self):
- tpl_snippet = '''
- imports:
- - some_definitions: custom_types/paypalpizzastore_nodejs_app.yaml
- - more_definitions:
- file: 'https://raw.githubusercontent.com/openstack/tosca-parser\
-/master/toscaparser/tests/data/custom_types/wordpress.yaml'
- namespace_prefix: single_instance_wordpress
- '''
- path = 'toscaparser/tests/data/tosca_elk.yaml'
- custom_defs = self._imports_content_test(tpl_snippet,
- path,
- "node_types")
- self.assertTrue(custom_defs.get("single_instance_wordpress.tosca."
- "nodes.WebApplication.WordPress"))
-
def test_imports_wth_namespace_prefix(self):
tpl_snippet = '''
imports:
@@ -382,21 +353,6 @@ tosca-parser/master/toscaparser/tests/da
tpl_snippet, None, None)
self.assertEqual(errormsg, err.__str__())
- def test_imports_duplicate_name(self):
- tpl_snippet = '''
- imports:
- - some_definitions: https://raw.githubusercontent.com/openstack/\
-tosca-parser/master/toscaparser/tests/data/custom_types/wordpress.yaml
- - some_definitions:
- file: my_defns/my_typesdefs_n.yaml
- '''
- errormsg = _('Duplicate import name "some_definitions" was found.')
- path = 'toscaparser/tests/data/tosca_elk.yaml'
- err = self.assertRaises(exception.ValidationError,
- self._imports_content_test,
- tpl_snippet, path, None)
- self.assertEqual(errormsg, err.__str__())
-
def test_imports_missing_req_field_in_def(self):
tpl_snippet = '''
imports:
@@ -414,38 +370,6 @@ tosca-parser/master/toscaparser/tests/da
tpl_snippet, path, None)
self.assertEqual(errormsg, err.__str__())
- def test_imports_file_with_uri(self):
- tpl_snippet = '''
- imports:
- - more_definitions:
- file: https://raw.githubusercontent.com/openstack/\
-tosca-parser/master/toscaparser/tests/data/custom_types/wordpress.yaml
- '''
- path = 'https://raw.githubusercontent.com/openstack/\
-tosca-parser/master/toscaparser/tests/data/\
-tosca_single_instance_wordpress_with_url_import.yaml'
- custom_defs = self._imports_content_test(tpl_snippet,
- path,
- "node_types")
- self.assertTrue(custom_defs.get("tosca.nodes."
- "WebApplication.WordPress"))
-
- def test_imports_file_namespace_fields(self):
- tpl_snippet = '''
- imports:
- - more_definitions:
- file: https://raw.githubusercontent.com/openstack/\
-heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
- namespace_prefix: mycompany
- namespace_uri: http://docs.oasis-open.org/tosca/ns/simple/yaml/1.0
- '''
- path = 'toscaparser/tests/data/tosca_elk.yaml'
- custom_defs = self._imports_content_test(tpl_snippet,
- path,
- "node_types")
- self.assertTrue(custom_defs.get("mycompany.tosca.nodes."
- "WebApplication.WordPress"))
-
def test_imports_file_with_suffix_yml(self):
tpl_snippet = '''
imports:
|