def test_deploys_to_host_with_environment(self): self.command.execute(name="something", image="imageId", public_key_file=StringIO("whatever"), progress=StringIO(), environment='staging') expected_host = Host() expected_host.environment = 'staging' self.deployer.deploy.assert_any_call(host=expected_host)
def test_deploys_to_host_with_kwargs(self): kwargs = { 'runlist': ['role[web]', 'recipe[test'], 'plugins': 'bootstrap', 'post_plugins': 'all_done' } self.command.execute(name="something", image="imageId", public_key_file=StringIO("whatever"), progress=StringIO(), **kwargs) expected_args = {'host': Host()} expected_args.update(kwargs) self.deployer.deploy.assert_any_call(**expected_args)
def setUp(self): self.host = Host(name="test.example.com", ip_address="50.56.57.58") self.ohai_data = { 'cloud': { 'inet1_address': '1.2.3.4' }, 'network': { 'eth0': 'eth 0 data', 'eth1': 'eth 1 data' }, 'hostname': 'test', 'keys': { 'ssh': { 'public_keys': 'yep' } } }
def test_returns_host_information(self): conn = mock.Mock() api = self._get_api_with_mocked_conn(conn) public_ipv4_address = "50.51.52.53" self.active_node.public_ips = ["2222::2222:2", public_ipv4_address] self.active_node.extra['password'] = '******' self.active_node.name = "some name" conn.create_node.return_value = self.active_node result = api.create_node(name="some name", image="5cebb13a-f783-4f8c-8058-c4182c724ccd", flavor="2", public_key_file=StringIO("some public key")) self.assertEquals( result, Host(name="some name", ip_address=public_ipv4_address))
def setUp(self): self.api = mock.Mock(spec=RackspaceApi) self.deployer = mock.Mock(spec=ChefDeployer) self.command = RackspaceRebuild(rackspace_api=self.api, chef_deployer=self.deployer) self.api.rebuild_node.return_value = Host()