Example #1
0
def main():
    conn = create_connection()
    if conn is None:
        exit(0)

    if not os.path.isfile('./databaseIsFilled.txt'):
        fill_database(conn)

    commands_manager = CommandsManager(conn)
    for arg in sys.argv:
        if "--sort_by" in arg:
            commands_manager.print_sorted_data()
        elif "--filter_by" in arg:
            commands_manager.print_filtered_data()
        elif "--compare" in arg:
            commands_manager.print_comparision()
        elif "--add" in arg:
            commands_manager.add_to_database()
        elif "--highscores" in arg:
            commands_manager.print_high_scores()
Example #2
0
def test_if_sorting_prints_proper_values(db, capsys):
    commands_manager = CommandsManager(db)
    commands_manager.add_to_database("it")
    commands_manager.print_sorted_data(["year", "runtime"])
    captured = capsys.readouterr()
    assert captured.out == """It - 2017 - 135 min