Merge "Allowing LP specification on cmd line"
This commit is contained in:
@@ -536,12 +536,8 @@ Available commands:
|
|||||||
raise exc.CommandException(message="Missing artifacts section")
|
raise exc.CommandException(message="Missing artifacts section")
|
||||||
elif plan_definition['artifacts'] is None:
|
elif plan_definition['artifacts'] is None:
|
||||||
raise exc.CommandException(message="Artifacts cannot be empty")
|
raise exc.CommandException(message="Artifacts cannot be empty")
|
||||||
elif 'name' not in plan_definition['artifacts'][0]:
|
|
||||||
raise exc.CommandException(message="Artifact name missing")
|
|
||||||
elif 'content' not in plan_definition['artifacts'][0]:
|
elif 'content' not in plan_definition['artifacts'][0]:
|
||||||
raise exc.CommandException(message="Artifact content missing")
|
raise exc.CommandException(message="Artifact content missing")
|
||||||
elif 'language_pack' not in plan_definition['artifacts'][0]:
|
|
||||||
raise exc.CommandException(message="Language pack missing")
|
|
||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
"""Print a list of all deployed applications."""
|
"""Print a list of all deployed applications."""
|
||||||
@@ -696,7 +692,9 @@ Available commands:
|
|||||||
while not name:
|
while not name:
|
||||||
name = raw_input("Please name the application.\n> ")
|
name = raw_input("Please name the application.\n> ")
|
||||||
plan_definition['name'] = name
|
plan_definition['name'] = name
|
||||||
plan_definition['artifacts'][0]['name'] = name
|
|
||||||
|
if 'name' not in plan_definition['artifacts'][0]:
|
||||||
|
plan_definition['artifacts'][0]['name'] = plan_definition['name']
|
||||||
|
|
||||||
if args.desc is not None:
|
if args.desc is not None:
|
||||||
plan_definition['description'] = args.desc
|
plan_definition['description'] = args.desc
|
||||||
|
@@ -274,20 +274,6 @@ class TestSolum(base.TestCase):
|
|||||||
out = self.shell("app create --plan-file /dev/null")
|
out = self.shell("app create --plan-file /dev/null")
|
||||||
self.assertEqual("ERROR: Artifacts cannot be empty\n", out)
|
self.assertEqual("ERROR: Artifacts cannot be empty\n", out)
|
||||||
|
|
||||||
def test_app_create_with_artifacts_no_name(self):
|
|
||||||
raw_data = 'version: 1\nname: ex_plan1\ndescription: d1.\nartifacts:\n'
|
|
||||||
raw_data += '- content:\n'
|
|
||||||
raw_data += ' href: asdfds\n'
|
|
||||||
raw_data += ' artifact_type: heroku\n'
|
|
||||||
raw_data += ' language_pack: lp'
|
|
||||||
|
|
||||||
mopen = mock.mock_open(read_data=raw_data)
|
|
||||||
|
|
||||||
with mock.patch('%s.open' % solum.__name__, mopen, create=True):
|
|
||||||
self.make_env()
|
|
||||||
out = self.shell("app create --plan-file /dev/null")
|
|
||||||
self.assertEqual("ERROR: Artifact name missing\n", out)
|
|
||||||
|
|
||||||
def test_app_create_with_artifacts_no_content(self):
|
def test_app_create_with_artifacts_no_content(self):
|
||||||
raw_data = 'version: 1\nname: ex_plan1\ndescription: d1.\nartifacts:\n'
|
raw_data = 'version: 1\nname: ex_plan1\ndescription: d1.\nartifacts:\n'
|
||||||
raw_data += '- name: asdfds\n'
|
raw_data += '- name: asdfds\n'
|
||||||
@@ -301,17 +287,6 @@ class TestSolum(base.TestCase):
|
|||||||
out = self.shell("app create --plan-file /dev/null")
|
out = self.shell("app create --plan-file /dev/null")
|
||||||
self.assertEqual("ERROR: Artifact content missing\n", out)
|
self.assertEqual("ERROR: Artifact content missing\n", out)
|
||||||
|
|
||||||
def test_app_create_with_artifacts_no_lp(self):
|
|
||||||
raw_data = 'version: 1\nname: ex_plan1\ndescription: d1.\nartifacts:\n'
|
|
||||||
raw_data += '- name:asdfds'
|
|
||||||
raw_data += ' content:asdfds'
|
|
||||||
mopen = mock.mock_open(read_data=raw_data)
|
|
||||||
|
|
||||||
with mock.patch('%s.open' % solum.__name__, mopen, create=True):
|
|
||||||
self.make_env()
|
|
||||||
out = self.shell("app create --plan-file /dev/null")
|
|
||||||
self.assertEqual("ERROR: Language pack missing\n", out)
|
|
||||||
|
|
||||||
# Plan Tests #
|
# Plan Tests #
|
||||||
@mock.patch.object(plan.PlanManager, "create")
|
@mock.patch.object(plan.PlanManager, "create")
|
||||||
def test_plan_create(self, mock_plan_create):
|
def test_plan_create(self, mock_plan_create):
|
||||||
|
Reference in New Issue
Block a user