def generate_stage(self, pipeline_stages, list_action, env, estrutura): pipeline = NewPipeline() stages = [] for t_stage in sorted(pipeline_stages): control_stage = t_stage.split('-')[1] if self.check_stage_not_env(estrutura, control_stage, env): if control_stage == 'Source': l_stage = [] for stg in list_action[control_stage]: l_stage.append(stg) stages.append(pipeline.create_stage('Source', l_stage)) else: l_stage = [] # print(pipeline_stages[t_stage]) for stg in pipeline_stages[t_stage]: for name_stg in stg: name_stg = name_stg.lower() if name_stg in list_action: l_stage.append(list_action[name_stg]) stages.append(pipeline.create_stage( control_stage, l_stage)) return stages
def test_deve_retornar_um_stage_Com_Nome_Alphanumerico(self, params): action = params['action'] name = 'Stage-Compilacao' pipeline = NewPipeline() cf_action = pipeline.create_action(action['name'], action['runorder'], action['configuration'], action['type'], action['role']) cf_stage = pipeline.create_stage(name, [cf_action]) cf = self.gerando_cloudformation(cf_stage) print(cf) assert 'StageCompilacao' in cf['Resources'] assert 'Stage-Compilacao' == cf['Resources']['StageCompilacao']['Name']
def test_deve_retornar_um_stage(self, params): action = params['action'] stage = params['stage'] pipeline = NewPipeline() cf_action = pipeline.create_action(action['name'], action['runorder'], action['configuration'], action['type'], action['role']) cf_stage = pipeline.create_stage(stage['name'], [cf_action]) cf = self.gerando_cloudformation(cf_stage) print(cf) assert 'Compilador' in cf['Resources'] assert 'Compilador' == cf['Resources']['Compilador']['Name']
def test_deve_retornar_uma_pipeline(self, params): action = params['action'] stage = params['stage'] pipeline = params['pipeline'] obj_pipeline = NewPipeline() cf_action = obj_pipeline.create_action(action['name'], action['runorder'], action['configuration'], action['type'], action['role']) cf_stage = obj_pipeline.create_stage(stage['name'], [cf_action]) cf_pipeline = obj_pipeline.create_pipeline(pipeline['name'], pipeline['role'], [cf_stage]) cf = self.gerando_cloudformation(cf_pipeline) print(cf) assert 'Pipelineecs' in cf['Resources']