Commit eab31655 authored by Kuhn's avatar Kuhn

Refactored zoe_lib/applications.py for testability

Broke the methods into smaller chunks of code so it is easier to mock
out the submethods and test.
parent 8e86e98d
......@@ -67,8 +67,11 @@ def app_validate(data):
if 'services' not in data:
raise InvalidApplicationDescription(msg='the application should contain a list of services')
for service in data['services']:
_service_check(service)
_validate_all_services(data['services'])
def _validate_all_services(data):
for service in data:
_service_check(data)
found_monitor = False
for service in data['services']:
......@@ -78,7 +81,6 @@ def app_validate(data):
if not found_monitor:
raise InvalidApplicationDescription(msg="at least one process should have monitor set to True")
def _service_check(data):
"""Check the service description schema."""
required_keys = ['name', 'docker_image', 'monitor', 'ports', 'required_resources', 'total_count', 'essential_count', 'startup_order']
......
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