def test_create_server_with_init_params(self): create_server_parameters = { 'm1.small': 'https://my.rightscale.com/api/acct/123/ec2_server_templates/52271', 'm1.large': 'https://my.rightscale.com/api/acct/123/ec2_server_templates/273583', } create_data = { 'server[nickname]' : 'torv', 'server[server_template_href]': create_server_parameters['m1.large'] } expected = urlencode(create_data) righteous.init('user', 'pass', 'account', **create_server_parameters) righteous.create_server('torv', 'm1.large') self.request.assert_called_once_with('/servers', method='POST', body=expected)
def test_create_server(self): nickname = 'foo' create_server_parameters = { 'server_template_href': 'https://my.rightscale.com/api/acct/281/ec2_server_templates/52271', 'm1.small': 'https://my.rightscale.com/api/acct/281/ec2_server_templates/52271', 'm1.large': 'https://my.rightscale.com/api/acct/281/ec2_server_templates/122880', } create_data = { 'server[nickname]' : nickname, 'server[server_template_href]': create_server_parameters['m1.large'] } expected = urlencode(create_data) righteous.create_server(nickname, 'm1.large', create_server_parameters=create_server_parameters) self.request.assert_called_once_with('/servers', method='POST', body=expected)
def test_create_server(self): location = righteous.create_server(self.env, 'm1.small') assert_not_equal(location, None) self.envs.append(self.env)