Merge "Update links for URL referenced templates"

This commit is contained in:
Jenkins
2015-09-20 18:08:28 +00:00
committed by Gerrit Code Review

View File

@@ -388,29 +388,34 @@ class ToscaTemplateTest(TestCase):
os.path.dirname(os.path.abspath(__file__)),
"data/tosca_single_instance_wordpress.yaml")
tosca = ToscaTemplate(tosca_tpl)
self.assertIsNotNone(tosca.topology_template.custom_defs)
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)
self.assertIsNotNone(tosca.topology_template.custom_defs)
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, False)
self.assertIsNotNone(tosca.topology_template.custom_defs)
self.assertTrue(tosca.topology_template.custom_defs)
def test_url_template_with_local_abspath_import(self):
tosca_tpl = ('http://tinyurl.com/nfbwjwd')
tosca_tpl = ('https://raw.githubusercontent.com/openstack/'
'tosca-parser/master/toscaparser/tests/data/'
'tosca_single_instance_wordpress_with_local_abspath_'
'import.yaml')
err = self.assertRaises(ImportError, ToscaTemplate, tosca_tpl, False)
self.assertEqual('Absolute file name cannot be used for a URL-based '
'input template.', err.__str__())
def test_url_template_with_url_import(self):
tosca_tpl = ('http://tinyurl.com/ow76273')
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, False)
self.assertIsNotNone(tosca.topology_template.custom_defs)
self.assertTrue(tosca.topology_template.custom_defs)