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:
