Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
ba7158ba
Commit
ba7158ba
authored
Nov 08, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrote tests
parent
ad992d3a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
281 additions
and
227 deletions
+281
-227
default_controller.py
...flask-server/sure_tosca/controllers/default_controller.py
+2
-4
tosca_template_service.py
...flask-server/sure_tosca/service/tosca_template_service.py
+1
-4
swagger.yaml
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
+20
-31
test_default_controller.py
...a-flask-server/sure_tosca/test/test_default_controller.py
+258
-188
No files found.
sure_tosca-flask-server/sure_tosca/controllers/default_controller.py
View file @
ba7158ba
...
@@ -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
...
...
sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py
View file @
ba7158ba
...
@@ -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
...
...
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
View file @
ba7158ba
...
@@ -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
typ
e"
description
:
"
The
type_nam
e"
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
"
additionalPropertie
s
:
item
s
:
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
"
item
s
:
additionalPropertie
s
:
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
:
...
...
sure_tosca-flask-server/sure_tosca/test/test_default_controller.py
View file @
ba7158ba
...
@@ -59,194 +59,264 @@ class TestDefaultController(BaseTestCase):
...
@@ -59,194 +59,264 @@ class TestDefaultController(BaseTestCase):
self
.
assertTrue
(
response
.
is_json
)
self
.
assertTrue
(
response
.
is_json
)
self
.
assertIsInstance
(
response
.
json
,
list
)
self
.
assertIsInstance
(
response
.
json
,
list
)
# def test_get_dsl_definitions(self):
def
test_get_dsl_definitions
(
self
):
# """Test case for get_dsl_definitions
"""Test case for get_dsl_definitions
#
#
# """
"""
# # query_string = [('anchors', 'anchors_example'), ('derived_from', 'derived_from_example')]
# query_string = [('anchors', 'anchors_example'), ('derived_from', 'derived_from_example')]
# response = self.client.open(
id_example
=
self
.
upload_file
()
# '/tosca-sure/1.0.0/tosca_template/{id}/dsl_definitions'.format(id='id_example'),
response
=
self
.
client
.
open
(
# method='GET')
'/tosca-sure/1.0.0/tosca_template/{id}/dsl_definitions'
.
format
(
id
=
id_example
),
# self.assert200(response,
method
=
'GET'
)
# 'Response body is : ' + response.data.decode('utf-8'))
self
.
assertTrue
(
response
.
is_json
)
#
# def test_get_imports(self):
def
test_get_imports
(
self
):
# """Test case for get_imports
"""Test case for get_imports
#
#
# """
"""
# response = self.client.open(
id_example
=
self
.
upload_file
()
# '/tosca-sure/1.0.0/tosca_template/{id}/imports'.format(id='id_example'),
response
=
self
.
client
.
open
(
# method='GET')
'/tosca-sure/1.0.0/tosca_template/{id}/imports'
.
format
(
id
=
id_example
),
# self.assert200(response,
method
=
'GET'
)
# 'Response body is : ' + response.data.decode('utf-8'))
self
.
assertTrue
(
response
.
is_json
)
#
# def test_get_node_outputs(self):
def
test_get_node_outputs
(
self
):
# """Test case for get_node_outputs
"""Test case for get_node_outputs
#
#
# """
"""
# response = self.client.open(
id_example
=
self
.
upload_file
()
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/outputs'.format(
response
=
self
.
client
.
open
(
# id='id_example', node_name='node_name_example'),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/outputs'
.
format
(
# method='GET')
id
=
id_example
,
node_name
=
'compute'
),
# self.assert200(response,
method
=
'GET'
)
# 'Response body is : ' + response.data.decode('utf-8'))
self
.
assertTrue
(
response
.
is_json
)
#
self
.
assertEqual
(
response
.
status_code
,
200
)
# def test_get_node_properties(self):
self
.
assertIsInstance
(
response
.
json
,
dict
)
# """Test case for get_node_properties
#
def
test_get_node_properties
(
self
):
#
"""Test case for get_node_properties
# """
# response = self.client.open(
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format(
"""
# id='id_example', node_name='node_name_example'),
id_example
=
self
.
upload_file
()
# method='GET')
response
=
self
.
client
.
open
(
# self.assert200(response,
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'
.
format
(
# 'Response body is : ' + response.data.decode('utf-8'))
id
=
id_example
,
node_name
=
'compute'
),
#
method
=
'GET'
)
# def test_get_node_requirements(self):
self
.
assertTrue
(
response
.
is_json
)
# """Test case for get_node_requirements
self
.
assertEqual
(
response
.
status_code
,
200
)
#
self
.
assertIsInstance
(
response
.
json
,
dict
)
#
# """
def
test_get_node_requirements
(
self
):
# response = self.client.open(
"""Test case for get_node_requirements
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/requirements'.format(
# id='id_example', node_name='node_name_example'),
# method='GET')
"""
# self.assert200(response,
id_example
=
self
.
upload_file
()
# 'Response body is : ' + response.data.decode('utf-8'))
response
=
self
.
client
.
open
(
#
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/requirements'
.
format
(
# def test_get_node_templates(self):
id
=
id_example
,
node_name
=
'kubernetes'
),
# """Test case for get_node_templates
method
=
'GET'
)
#
self
.
assertTrue
(
response
.
is_json
)
#
self
.
assertEqual
(
response
.
status_code
,
200
)
# """
self
.
assertIsInstance
(
response
.
json
,
list
)
# query_string = [('type_name', 'type_name_example'),
# ('node_name', 'node_name_example'),
def
test_get_node_templates
(
self
):
# ('has_interfaces', True),
"""Test case for get_node_templates
# ('has_properties', True),
# ('has_attributes', True),
# ('has_requirements', True),
"""
# ('has_capabilities', True),
id_example
=
self
.
upload_file
()
# ('has_artifacts', True),
query_string
=
[(
'type_name'
,
None
),
# ('derived_from', 'derived_from_example')]
(
'node_name'
,
'compute'
),
# response = self.client.open(
(
'has_interfaces'
,
True
),
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates'.format(id='id_example'),
(
'has_properties'
,
None
),
# method='GET',
(
'has_attributes'
,
None
),
# query_string=query_string)
(
'has_requirements'
,
None
),
# self.assert200(response,
(
'has_capabilities'
,
None
),
# 'Response body is : ' + response.data.decode('utf-8'))
(
'has_artifacts'
,
None
)]
#
response
=
self
.
client
.
open
(
# def test_get_node_type_name(self):
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates'
.
format
(
id
=
id_example
),
# """Test case for get_node_type_name
method
=
'GET'
,
#
query_string
=
query_string
)
#
self
.
assertTrue
(
response
.
is_json
)
# """
self
.
assertEqual
(
response
.
status_code
,
200
)
# response = self.client.open(
self
.
assertIsInstance
(
response
.
json
,
list
)
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/type_name'.format(
# id='id_example', node_name='node_name_example'),
query_string
=
[(
'type_name'
,
None
),
# method='GET')
(
'node_name'
,
None
),
# self.assert200(response,
(
'has_interfaces'
,
None
),
# 'Response body is : ' + response.data.decode('utf-8'))
(
'has_properties'
,
None
),
#
(
'has_attributes'
,
None
),
# def test_get_parent_type_name(self):
(
'has_requirements'
,
None
),
# """Test case for get_parent_type_name
(
'has_capabilities'
,
None
),
#
(
'has_artifacts'
,
None
)]
#
response
=
self
.
client
.
open
(
# """
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates'
.
format
(
id
=
id_example
),
# response = self.client.open(
method
=
'GET'
,
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from'.format(
query_string
=
query_string
)
# id='id_example', node_name='node_name_example'),
self
.
assertTrue
(
response
.
is_json
)
# method='GET')
self
.
assertEqual
(
response
.
status_code
,
200
)
# self.assert200(response,
self
.
assertIsInstance
(
response
.
json
,
list
)
# 'Response body is : ' + response.data.decode('utf-8'))
#
query_string
=
[(
'type_name'
,
'tosca.nodes.ARTICONF.Container.Application.Docker'
),
# def test_get_related_nodes(self):
(
'node_name'
,
None
),
# """Test case for get_related_nodes
(
'has_interfaces'
,
None
),
#
(
'has_properties'
,
None
),
#
(
'has_attributes'
,
None
),
# """
(
'has_requirements'
,
None
),
# response = self.client.open(
(
'has_capabilities'
,
None
),
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/related'.format(
(
'has_artifacts'
,
None
)]
# id='id_example', node_name='node_name_example'),
response
=
self
.
client
.
open
(
# method='GET')
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates'
.
format
(
id
=
id_example
),
# self.assert200(response,
method
=
'GET'
,
# 'Response body is : ' + response.data.decode('utf-8'))
query_string
=
query_string
)
#
self
.
assertTrue
(
response
.
is_json
)
# def test_get_relationship_templates(self):
self
.
assertEqual
(
response
.
status_code
,
200
)
# """Test case for get_relationship_templates
self
.
assertIsInstance
(
response
.
json
,
list
)
#
#
def
test_get_node_type_name
(
self
):
# """
"""Test case for get_node_type_name
# query_string = [('type_name', 'type_name_example'),
# ('derived_from', 'derived_from_example')]
# response = self.client.open(
"""
# '/tosca-sure/1.0.0/tosca_template/{id}/relationship_templates'.format(id='id_example'),
id_example
=
self
.
upload_file
()
# method='GET',
response
=
self
.
client
.
open
(
# query_string=query_string)
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/type_name'
.
format
(
# self.assert200(response,
id
=
id_example
,
node_name
=
'compute'
),
# 'Response body is : ' + response.data.decode('utf-8'))
method
=
'GET'
)
#
self
.
assertTrue
(
response
.
is_json
)
# def test_get_topology_template(self):
self
.
assertEqual
(
response
.
status_code
,
200
)
# """Test case for get_topology_template
self
.
assertIsInstance
(
response
.
json
,
str
)
#
#
def
test_get_parent_type_name
(
self
):
# """
"""Test case for get_parent_type_name
# response = self.client.open(
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template'.format(id='id_example'),
# method='GET')
"""
# self.assert200(response,
id_example
=
self
.
upload_file
()
# 'Response body is : ' + response.data.decode('utf-8'))
response
=
self
.
client
.
open
(
#
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from'
.
format
(
# def test_get_tosca_template(self):
id
=
id_example
,
node_name
=
'kubernetes'
),
# """Test case for get_tosca_template
method
=
'GET'
)
#
self
.
assertTrue
(
response
.
is_json
)
#
self
.
assertEqual
(
response
.
status_code
,
200
)
# """
self
.
assertIsInstance
(
response
.
json
,
str
)
# response = self.client.open(
# '/tosca-sure/1.0.0/tosca_template/{id}'.format(id='id_example'),
def
test_get_related_nodes
(
self
):
# method='GET')
"""Test case for get_related_nodes
# self.assert200(response,
# 'Response body is : ' + response.data.decode('utf-8'))
#
"""
# def test_get_types(self):
id_example
=
self
.
upload_file
()
# """Test case for get_types
response
=
self
.
client
.
open
(
#
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/related'
.
format
(
#
id
=
id_example
,
node_name
=
'mysql'
),
# """
method
=
'GET'
)
# query_string = [('kind_of_type', 'kind_of_type_example'),
self
.
assertTrue
(
response
.
is_json
)
# ('has_interfaces', True),
self
.
assertEqual
(
response
.
status_code
,
200
)
# ('type_name', 'type_name_example'),
self
.
assertIsInstance
(
response
.
json
,
list
)
# ('has_properties', True),
# ('has_attributes', True),
def
test_get_relationship_templates
(
self
):
# ('has_requirements', True),
"""Test case for get_relationship_templates
# ('has_capabilities', True),
# ('has_artifacts', True),
# ('derived_from', 'derived_from_example')]
"""
# response = self.client.open(
id_example
=
self
.
upload_file
()
# '/tosca-sure/1.0.0/tosca_template/{id}/types'.format(id='id_example'),
query_string
=
[(
'type_name'
,
None
),
# method='GET',
(
'derived_from'
,
None
)]
# query_string=query_string)
response
=
self
.
client
.
open
(
# self.assert200(response,
'/tosca-sure/1.0.0/tosca_template/{id}/relationship_templates'
.
format
(
id
=
id_example
),
# 'Response body is : ' + response.data.decode('utf-8'))
method
=
'GET'
,
#
query_string
=
query_string
)
# def test_set_node_properties(self):
self
.
assertTrue
(
response
.
is_json
)
# """Test case for set_node_properties
#
def
test_get_topology_template
(
self
):
#
"""Test case for get_topology_template
# """
# properties = None
# response = self.client.open(
"""
# '/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'.format(
id_example
=
self
.
upload_file
()
# id='id_example', node_name='node_name_example'),
response
=
self
.
client
.
open
(
# method='PUT',
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template'
.
format
(
id
=
id_example
),
# data=json.dumps(properties),
method
=
'GET'
)
# content_type='application/json')
self
.
assertTrue
(
response
.
is_json
)
# self.assert200(response,
self
.
assertEqual
(
response
.
status_code
,
200
)
# 'Response body is : ' + response.data.decode('utf-8'))
self
.
assertIsInstance
(
response
.
json
,
dict
)
#
def
test_get_tosca_template
(
self
):
"""Test case for get_tosca_template
"""
id_example
=
self
.
upload_file
()
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}'
.
format
(
id
=
id_example
),
method
=
'GET'
)
self
.
assertTrue
(
response
.
is_json
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertIsInstance
(
response
.
json
,
dict
)
def
test_get_types
(
self
):
"""Test case for get_types
"""
id_example
=
self
.
upload_file
()
query_string
=
[(
'kind_of_type'
,
'interface_types'
),
(
'has_interfaces'
,
None
),
(
'type_name'
,
'tosca.interfaces.ARTICONF.CloudsStorm'
),
(
'has_properties'
,
None
),
(
'has_attributes'
,
None
),
(
'has_requirements'
,
None
),
(
'has_capabilities'
,
None
),
(
'has_artifacts'
,
None
),
(
'derived_from'
,
None
)]
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/types'
.
format
(
id
=
id_example
),
method
=
'GET'
,
query_string
=
query_string
)
self
.
assertTrue
(
response
.
is_json
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertIsInstance
(
response
.
json
,
list
)
query_string
=
[(
'kind_of_type'
,
'interface_types'
),
(
'has_interfaces'
,
None
),
(
'type_name'
,
None
),
(
'has_properties'
,
None
),
(
'has_attributes'
,
None
),
(
'has_requirements'
,
None
),
(
'has_capabilities'
,
None
),
(
'has_artifacts'
,
None
),
(
'derived_from'
,
'tosca.interfaces.node.lifecycle.Standard'
)]
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/types'
.
format
(
id
=
id_example
),
method
=
'GET'
,
query_string
=
query_string
)
self
.
assertTrue
(
response
.
is_json
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertIsInstance
(
response
.
json
,
list
)
def
test_set_node_properties
(
self
):
"""Test case for set_node_properties
"""
id_example
=
self
.
upload_file
()
properties
=
{
'properties'
:
{
'cpu_frequency'
:
'2 GHz'
}}
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_name}/properties'
.
format
(
id
=
id_example
,
node_name
=
'compute'
),
method
=
'PUT'
,
data
=
json
.
dumps
(
properties
),
content_type
=
'application/json'
)
self
.
assertTrue
(
response
.
is_json
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertIsInstance
(
response
.
json
,
list
)
# def test_upload_tosca_template(self):
# def test_upload_tosca_template(self):
# """Test case for upload_tosca_template
# """Test case for upload_tosca_template
#
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment