def pretty_print_challenge_details(challenge): table = BeautifulTable(max_width=200) attributes = [ "description", "submission_guidelines", "evaluation_details", "terms_and_conditions", ] table.column_headers = [ "Start Date", "End Date", "Description", "Submission Guidelines", "Evaluation Details", "Terms and Conditions", ] values = [] start_date = convert_UTC_date_to_local( challenge["start_date"]).split(" ")[0] end_date = convert_UTC_date_to_local(challenge["end_date"]).split(" ")[0] values.extend([start_date, end_date]) values.extend( list(map(lambda item: clean_data(challenge[item]), attributes))) table.append_row(values) echo(table)
def test_display_challenge_details(self): table = BeautifulTable(max_width=200) attributes = [ "description", "submission_guidelines", "evaluation_details", "terms_and_conditions" ] column_attributes = [ "Start Date", "End Date", "Description", "Submission Guidelines", "Evaluation Details", "Terms and Conditions" ] table.column_headers = column_attributes values = [] start_date = convert_UTC_date_to_local( self.challenge_data["start_date"]).split(" ")[0] end_date = convert_UTC_date_to_local( self.challenge_data["end_date"]).split(" ")[0] values.extend([start_date, end_date]) values.extend( list( map(lambda item: clean_data(self.challenge_data[item]), attributes))) table.append_row(values) expected = str(table) runner = CliRunner() result = runner.invoke(challenge, ["1"]) response = result.output.strip() assert response == expected
def pretty_print_all_challenge_phases(phases): """ Function to print all the challenge phases of a challenge """ table = BeautifulTable(max_width=150) attributes = ["id", "name", "challenge"] columns_attributes = [ "Phase ID", "Phase Name", "Challenge ID", "Description" ] table.column_headers = columns_attributes for phase in phases: values = list(map(lambda item: phase[item], attributes)) description = clean_data(phase["description"]) values.append(description) table.append_row(values) echo(table)
def test_display_challenge_phase_list(self): table = BeautifulTable(max_width=150) attributes = ["id", "name", "challenge"] columns_attributes = [ "Phase ID", "Phase Name", "Challenge ID", "Description" ] table.column_headers = columns_attributes for phase in self.phases: values = list(map(lambda item: phase[item], attributes)) description = clean_data(phase["description"]) values.append(description) table.append_row(values) output = str(table) runner = CliRunner() result = runner.invoke(challenge, ['10', 'phases']) response = result.output.rstrip() assert response == output