Commit ba7158ba authored by Spiros Koulouzis's avatar Spiros Koulouzis

wrote tests

parent ad992d3a
...@@ -153,8 +153,7 @@ def get_node_requirements(id, node_name): # noqa: E501 ...@@ -153,8 +153,7 @@ def get_node_requirements(id, node_name): # noqa: E501
def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None, has_properties=None, def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None, has_properties=None,
has_attributes=None, has_requirements=None, has_capabilities=None, has_artifacts=None, has_attributes=None, has_requirements=None, has_capabilities=None, has_artifacts=None): # noqa: E501
derived_from=None): # noqa: E501
"""get_node_templates """get_node_templates
returns nodes templates in topology # noqa: E501 returns nodes templates in topology # noqa: E501
...@@ -185,8 +184,7 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None, ...@@ -185,8 +184,7 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None,
res = tosca_template_service.get_node_templates(id, type_name=type_name, node_name=node_name, res = tosca_template_service.get_node_templates(id, type_name=type_name, node_name=node_name,
has_interfaces=has_interfaces, has_properties=has_properties, has_interfaces=has_interfaces, has_properties=has_properties,
has_attributes=has_attributes, has_requirements=has_requirements, has_attributes=has_attributes, has_requirements=has_requirements,
has_capabilities=has_capabilities, has_artifacts=has_artifacts, has_capabilities=has_capabilities, has_artifacts=has_artifacts)
derived_from=derived_from)
if res: if res:
return res return res
return 'Not Found', 404 return 'Not Found', 404
......
...@@ -117,7 +117,7 @@ def get_interface_types(id, interface_type=None): ...@@ -117,7 +117,7 @@ def get_interface_types(id, interface_type=None):
def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None, has_properties=None, def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None, has_properties=None,
has_attributes=None, has_attributes=None,
has_requirements=None, has_capabilities=None, has_artifacts=None, derived_from=None): has_requirements=None, has_capabilities=None, has_artifacts=None):
if len(node_template_db) <= 1: if len(node_template_db) <= 1:
tosca_template_model = get_tosca_template_model_by_id(id) tosca_template_model = get_tosca_template_model_by_id(id)
object_list = tosca_template_model.topology_template.node_templates object_list = tosca_template_model.topology_template.node_templates
...@@ -147,9 +147,6 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None, ...@@ -147,9 +147,6 @@ def get_node_templates(id, type_name=None, node_name=None, has_interfaces=None,
if type_name: if type_name:
query = Query() query = Query()
queries.append(query.type == type_name) queries.append(query.type == type_name)
if derived_from:
query = Query()
queries.append(query.derived_from == derived_from)
if has_properties: if has_properties:
query = Query() query = Query()
prop = None prop = None
......
...@@ -161,7 +161,7 @@ paths: ...@@ -161,7 +161,7 @@ paths:
type: "boolean" type: "boolean"
- name: "type_name" - name: "type_name"
in: "query" in: "query"
description: "The relationship type" description: "The type_name"
required: false required: false
type: "string" type: "string"
- name: "has_properties" - name: "has_properties"
...@@ -321,11 +321,6 @@ paths: ...@@ -321,11 +321,6 @@ paths:
description: "filter if has artifacts" description: "filter if has artifacts"
required: false required: false
type: "boolean" type: "boolean"
- name: "derived_from"
in: "query"
description: "derived from"
required: false
type: "string"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
...@@ -582,7 +577,7 @@ paths: ...@@ -582,7 +577,7 @@ paths:
200: 200:
description: "successful operation" description: "successful operation"
schema: schema:
$ref: "#/definitions/NodeTemplate" type: "string"
404: 404:
description: "Not found" description: "Not found"
405: 405:
...@@ -610,10 +605,12 @@ paths: ...@@ -610,10 +605,12 @@ paths:
200: 200:
description: "successful operation" description: "successful operation"
schema: schema:
type: "object" type: "array"
additionalProperties: items:
type: "object" type: "object"
properties: {} additionalProperties:
type: "object"
properties: {}
404: 404:
description: "Not found" description: "Not found"
405: 405:
...@@ -717,7 +714,8 @@ definitions: ...@@ -717,7 +714,8 @@ definitions:
policy_types: policy_types:
type: "object" type: "object"
additionalProperties: additionalProperties:
type: "string" type: "object"
properties: {}
group_types: group_types:
type: "object" type: "object"
additionalProperties: additionalProperties:
...@@ -732,16 +730,14 @@ definitions: ...@@ -732,16 +730,14 @@ definitions:
node_types: node_types:
key: "{}" key: "{}"
policy_types: policy_types:
key: "policy_types" key: "{}"
topology_template: topology_template:
outputs: outputs:
- key: "{}" key: "{}"
- key: "{}"
substitution_mappings: substitution_mappings:
key: "{}" key: "{}"
inputs: inputs:
- key: "{}" key: "inputs"
- key: "{}"
node_templates: node_templates:
key: key:
requirements: requirements:
...@@ -804,12 +800,9 @@ definitions: ...@@ -804,12 +800,9 @@ definitions:
description: description:
type: "string" type: "string"
inputs: inputs:
type: "array" type: "object"
items: additionalProperties:
type: "object" type: "string"
additionalProperties:
type: "object"
properties: {}
node_templates: node_templates:
type: "object" type: "object"
additionalProperties: additionalProperties:
...@@ -820,12 +813,10 @@ definitions: ...@@ -820,12 +813,10 @@ definitions:
type: "object" type: "object"
properties: {} properties: {}
outputs: outputs:
type: "array" type: "object"
items: additionalProperties:
type: "object" type: "object"
additionalProperties: properties: {}
type: "object"
properties: {}
groups: groups:
type: "object" type: "object"
additionalProperties: additionalProperties:
...@@ -845,13 +836,11 @@ definitions: ...@@ -845,13 +836,11 @@ definitions:
properties: {} properties: {}
example: example:
outputs: outputs:
- key: "{}" key: "{}"
- key: "{}"
substitution_mappings: substitution_mappings:
key: "{}" key: "{}"
inputs: inputs:
- key: "{}" key: "inputs"
- key: "{}"
node_templates: node_templates:
key: key:
requirements: requirements:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment