def test_create_stack(self): """Create stack calls Heat and returns the new stack details on 201.""" data = {'data': 'data'} body = {'stack': 'the_stack_json'} eff = create_stack(data) expected_intent = self._create_stack_intent(data) seq = [(expected_intent, service_request_eqf(stub_pure_response(json.dumps(body), 201))), (log_intent('request-create-stack', body), lambda _: None)] result = perform_sequence(seq, eff) self.assertEqual(result, 'the_stack_json')
def test_create_stack(self): """Create stack calls Heat and returns the new stack details on 201.""" data = {'data': 'data'} body = {'stack': 'the_stack_json'} eff = create_stack(data) expected_intent = self._create_stack_intent(data) seq = [ (expected_intent, service_request_eqf(stub_pure_response(json.dumps(body), 201))), (log_intent('request-create-stack', body), lambda _: None) ] result = perform_sequence(seq, eff) self.assertEqual(result, 'the_stack_json')
def test_normal_use(self): """Tests normal usage.""" stack_config = pmap({'stack_name': 'baz', 'foo': 'bar'}) new_stack_config = pmap({'stack_name': 'baz_foo', 'foo': 'bar'}) self.create = CreateStack(stack_config) self.seq = [ (Func(uuid4), lambda _: 'foo'), (create_stack(thaw(new_stack_config)).intent, lambda _: (StubResponse(200, {}), {'stack': {}})), (Log('request-create-stack', ANY), lambda _: None) ] reason = 'Waiting for stack to create' result = perform_sequence(self.seq, self.create.as_effect()) self.assertEqual(result, (StepResult.RETRY, [ErrorReason.String(reason)]))
def got_uuid(uuid): stack_config = append_stack_uuid(self.stack_config, uuid) return create_stack(thaw(stack_config)).on( _success_reporter('Waiting for stack to create'))