def display_failed_test_menu(self): """ Display Failed Tests Jobs """ button_template = ButtonsTemplate() job_list = jenkins.list_failed_job() if len(job_list) > 0: button_template.text = 'Please Select The Failed Test Jobs' button_template.thumbnail_image_url = '{0}/confirm_rerun_failed_test.jpg'.format( bucket_prefix) for job in job_list: job_name = job['name'] button_template.actions.append( PostbackAction(label=job_name, data='rerun_test={}'.format(job_name))) else: button_template.text = 'Congratulations! All Tests are Passed' button_template.thumbnail_image_url = 'https://images.pexels.com/photos/941693/pexels-photo-941693.jpeg' button_template.actions.append( PostbackAction(label='OK', data='OK')) return button_template
def display_test_job_menu(self, data, image_url='run.jpg'): """ Display Job List Menu. """ button_template = ButtonsTemplate() button_template.text = 'Please Select The Job' job_list = jenkins.list_job() button_template.thumbnail_image_url = '{0}/{1}'.format( bucket_prefix, image_url) for job in job_list: job_name = job['name'] button_template.actions.append( PostbackAction(label=job_name, data=data.format(job_name))) return button_template