155
155
self.mocker.replay()
156
156
self.mocker.result(succeed(True))
158
self.capture_stream('stderr')
158
self.capture_stream("stderr")
159
159
main(["deploy", "--environment", "secondenv", "--repository",
160
160
self.unbundled_repo_path, "sample"])
245
245
def test_deploy_with_config(self):
246
246
"""Valid config options should be available to the deployed
248
config_file = self.makeFile(yaml.dump(dict(myblog=dict(application_file="foo"))))
248
config_file = self.makeFile(yaml.dump(dict(
249
myblog=dict(outlook="sunny",
250
username="tester01"))))
249
251
environment = self.config.get("firstenv")
251
253
yield deploy.deploy(self.config, environment, self.unbundled_repo_path,
252
"sample", "myblog", logging.getLogger("deploy"),
254
"dummy", "myblog", logging.getLogger("deploy"),
255
257
# Verify that options in the yaml are available as state after
256
258
# the deploy call (successfully applied)
257
259
service = yield ServiceStateManager(self.client).get_service_state("myblog")
258
260
config = yield service.get_config()
259
self.assertEqual(config["application_file"], "foo")
261
self.assertEqual(config["outlook"], "sunny")
262
self.assertEqual(config["username"], "tester01")
263
# a default value from the config.yaml
264
self.assertEqual(config["title"], "My Title")
267
def test_deploy_with_default_config(self):
268
"""Valid config options should be available to the deployed
270
environment = self.config.get("firstenv")
272
# Here we explictly pass no config file but the services
273
# associated config.yaml defines default which we expect to
275
yield deploy.deploy(self.config, environment, self.unbundled_repo_path,
276
"dummy", "myblog", logging.getLogger("deploy"),
279
# Verify that options in the yaml are available as state after
280
# the deploy call (successfully applied)
281
service = yield ServiceStateManager(self.client).get_service_state("myblog")
282
config = yield service.get_config()
283
self.assertEqual(config["title"], "My Title")
262
286
def test_deploy_adds_peer_relations(self):