Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-1-parser-test-suite 354328e94 -> 055ae3a65


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/055ae3a6/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
index fba969a..1edc2cb 100644
--- 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
@@ -18,7 +18,29 @@ import pytest
 
 from ... import data
 
-# Syntax
+
+# Capabilities section
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT)
+def test_node_type_capabilities_section_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    capabilities: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_capabilities_section_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    capabilities: {}
+""").assert_success()
+
+
+# Capability
 
 @pytest.mark.parametrize('value', data.NOT_A_DICT)
 def test_node_type_capability_syntax_type(parser, value):
@@ -153,23 +175,23 @@ node_types:
 
 # Valid source types
 
-def test_node_type_capability_valid_source_types(parser):
+@pytest.mark.parametrize('value', data.NOT_A_LIST)
+def test_node_type_capability_valid_source_types_syntax_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
   MyType: {}
 node_types:
-  MyType1:
+  MyType:
     capabilities:
       my_capability:
         type: MyType
-        valid_source_types: [ MyType1, MyType2 ]
-  MyType2: {}
-""").assert_success()
+        valid_source_types: {{ value }}
+""", dict(value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('value', data.NOT_A_LIST)
-def test_node_type_capability_valid_source_types_syntax_type(parser, value):
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_capability_valid_source_types_syntax_element_type(parser, 
value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -179,12 +201,11 @@ node_types:
     capabilities:
       my_capability:
         type: MyType
-        valid_source_types: {{ value }}
+        valid_source_types: [ {{ value }} ]
 """, dict(value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('value', data.NOT_A_STRING)
-def test_node_type_capability_valid_source_types_syntax_element_type(parser, 
value):
+def test_node_type_capability_valid_source_types_syntax_empty(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -194,21 +215,23 @@ node_types:
     capabilities:
       my_capability:
         type: MyType
-        valid_source_types: [ {{ value }} ]
-""", dict(value=value)).assert_failure()
+        valid_source_types: []
+""").assert_success()
+
 
 
-def test_node_type_capability_valid_source_syntax_empty(parser):
+def test_node_type_capability_valid_source_types(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
   MyType: {}
 node_types:
-  MyType:
+  MyType1:
     capabilities:
       my_capability:
         type: MyType
-        valid_source_types: []
+        valid_source_types: [ MyType1, MyType2 ]
+  MyType2: {}
 """).assert_success()
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/055ae3a6/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
index 0c29595..710bd22 100644
--- 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
@@ -19,7 +19,28 @@ import pytest
 from ... import data
 
 
-# Syntax
+# Requirements section
+
+@pytest.mark.parametrize('value', data.NOT_A_LIST)
+def test_node_type_requirements_section_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    requirements: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_requirements_section_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+node_types:
+  MyType:
+    requirements: []
+""").assert_success()
+
+
+# Requirement
 
 @pytest.mark.parametrize('value', data.NOT_A_DICT)
 def test_node_type_requirement_syntax_type(parser, value):
@@ -96,6 +117,8 @@ node_types:
 """).assert_success()
 
 
+# Capability type
+
 def test_node_type_requirement_capability_type_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
@@ -182,7 +205,7 @@ node_types:
 # Relationship
 
 @pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
-def test_node_type_requirement_relationship_type_syntax_type(parser, value):
+def test_node_type_requirement_relationship_syntax_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -227,6 +250,24 @@ node_types:
 """).assert_success()
 
 
+# Relationship type
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
+def test_node_type_requirement_relationship_type_syntax_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
+node_types:
+  MyType:
+    requirements:
+      - my_requirement:
+          capability: MyType
+          relationship:
+            type: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
 def test_node_type_requirement_relationship_type_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/055ae3a6/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
index 0459d11..ff579f9 100644
--- 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_artifact_type.py
@@ -19,18 +19,6 @@ import pytest
 from .. import data
 
 
-# Syntax
-
-def test_artifact_type_fields(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-artifact_types:
-  MyType:
-    mime_type: a mime type
-    file_ext: [ an extension ]
-""").assert_success()
-
-
 # MIME type
 
 @pytest.mark.parametrize('value', data.NOT_A_STRING)
@@ -55,20 +43,20 @@ artifact_types:
 """, dict(value=value)).assert_failure()
 
 
-def test_artifact_type_file_ext_syntax_empty(parser):
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_artifact_type_file_ext_syntax_element_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 artifact_types:
   MyType:
-    file_ext: []
-""").assert_success()
+    file_ext: [ {{ value }} ]
+""", dict(value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('value', data.NOT_A_STRING)
-def test_artifact_type_file_ext_syntax_element_type(parser, value):
+def test_artifact_type_file_ext_syntax_empty(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 artifact_types:
   MyType:
-    file_ext: [ {{ value }} ]
-""", dict(value=value)).assert_failure()
+    file_ext: []
+""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/055ae3a6/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
----------------------------------------------------------------------
diff --git 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
index d296930..1bdd0a7 100644
--- 
a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
+++ 
b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
@@ -19,7 +19,7 @@ import pytest
 from .. import data
 
 
-# Operations
+# Operation
 
 def test_interface_type_operation_syntax_empty(parser):
     parser.parse_literal("""
@@ -105,7 +105,7 @@ interface_types:
 
 
 @pytest.mark.parametrize('value', data.NOT_A_STRING)
-def test_interface_type_operation_dependencies_element_syntax_type(parser, 
value):
+def test_interface_type_operation_dependencies_syntax_element_type(parser, 
value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 interface_types:
@@ -118,6 +118,18 @@ interface_types:
 """, dict(value=value)).assert_failure()
 
 
+def test_interface_type_operation_dependencies_syntax_empty(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+interface_types:
+  MyType:
+    my_operation:
+      implementation:
+        primary: an implementation
+        dependencies: []
+""").assert_success()
+
+
 # Unicode
 
 def test_interface_type_unicode(parser):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/055ae3a6/tests/mechanisms/parsing/__init__.py
----------------------------------------------------------------------
diff --git a/tests/mechanisms/parsing/__init__.py 
b/tests/mechanisms/parsing/__init__.py
index b2b5146..1e6750a 100644
--- a/tests/mechanisms/parsing/__init__.py
+++ b/tests/mechanisms/parsing/__init__.py
@@ -51,13 +51,13 @@ class Parser(object):
     def __init__(self):
         self.verbose = False
 
-    def parse_literal(self, text, context=None):
+    def parse_literal(self, text, context=None, import_profile=False):
         text = render(text, context)
-        parsed = self._parse_literal(text)
+        parsed = self._parse_literal(text, import_profile)
         parsed.verbose = self.verbose
         return parsed
 
-    def _parse_literal(self, text):
+    def _parse_literal(self, text, import_profile):
         raise NotImplementedError
 
     def __enter__(self):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/055ae3a6/tests/mechanisms/parsing/aria.py
----------------------------------------------------------------------
diff --git a/tests/mechanisms/parsing/aria.py b/tests/mechanisms/parsing/aria.py
index 63aadb7..59ef9ef 100644
--- a/tests/mechanisms/parsing/aria.py
+++ b/tests/mechanisms/parsing/aria.py
@@ -29,8 +29,8 @@ from . import (Parser, Parsed)
 
 
 class AriaParser(Parser):
-    def _parse_literal(self, text):
-        context = AriaParser.create_context()
+    def _parse_literal(self, text, import_profile):
+        context = AriaParser.create_context(import_profile=import_profile)
         context.presentation.location = LiteralLocation(text)
         consumer = AriaParser.create_consumer(context)
         consumer.consume()
@@ -45,13 +45,17 @@ class AriaParser(Parser):
                        reader_source='aria.parser.reading.DefaultReaderSource',
                        
presenter_source='aria.parser.presentation.DefaultPresenterSource',
                        presenter=None,
-                       debug=False):
+                       debug=False,
+                       cache=True,
+                       import_profile=False):
         context = ConsumptionContext()
         context.loading.loader_source = import_fullname(loader_source)()
         context.reading.reader_source = import_fullname(reader_source)()
         context.presentation.presenter_source = 
import_fullname(presenter_source)()
         context.presentation.presenter_class = import_fullname(presenter)
         context.presentation.threads = 1 # tests already run in maximum thread 
density
+        context.presentation.cache = cache
+        context.presentation.import_profile = import_profile
         context.presentation.print_exceptions = debug
         return context
 

Reply via email to