Beispiel #1
0
def test_single_appointment_default_background_writes_white_on_black(
        config, mocker):
    found_appointments = [Appointment(start="2020-02-20 12:00")]
    mocker.patch("where_to.outlook.find_appointments_between",
                 return_value=found_appointments)
    application = Application(config)

    application.run()
Beispiel #2
0
def test_single_appointment_yellow_background_writes_black_on_yellow(
        config, mocker):
    found_appointments = [Appointment(start="2020-02-20 12:00")]
    mocker.patch("where_to.outlook.find_appointments_between",
                 return_value=found_appointments)
    config.background_color = "yellow"
    application = Application(config)

    application.run()
Beispiel #3
0
def test_single_appointment_dark_checkered_background_writes_white(
        config, mocker, request):
    found_appointments = [Appointment(start="2020-02-20 12:00")]
    mocker.patch("where_to.outlook.find_appointments_between",
                 return_value=found_appointments)

    config.background_image = os.path.abspath(
        os.path.join(os.path.dirname(request.fspath), "backgrounds",
                     "black_and_navy_checkered.png"))
    application = Application(config)

    application.run()
Beispiel #4
0
def test_upcoming_appointments_are_sorted(config, mocker, capsys):
    expected_output = console("2020-02-20 08:30:00 [Location]",
                              "2020-02-20 10:30:00 [Location]",
                              "2020-02-20 12:00:00 [Location]")
    found_appointments = [
        Appointment(start="2020-02-20 12:00"),
        Appointment(start="2020-02-20 08:30"),
        Appointment(start="2020-02-20 10:30"),
    ]
    mocker.patch("where_to.outlook.find_appointments_between",
                 return_value=found_appointments)
    application = Application(config)

    application.run()

    captured = capsys.readouterr()
    assert expected_output == captured.out
Beispiel #5
0
def test_next_appointment_shows_next_only(config, mocker, capsys):
    expected_output = console("2020-02-20 12:00:00 [Location]")

    found_appointments = [
        Appointment(start="2020-02-20 12:00"),
        Appointment(start="2020-02-20 13:30"),
        Appointment(start="2020-02-20 13:30"),
    ]
    mocker.patch("where_to.outlook.find_appointments_between",
                 return_value=found_appointments)

    config.which = "next"
    application = Application(config)

    application.run()

    captured = capsys.readouterr()
    assert expected_output == captured.out
Beispiel #6
0
def test_next_appointment_shows_multiple_with_same_start(
        config, mocker, capsys):
    expected_output = console("2020-02-20 08:30:00 Location 1",
                              "2020-02-20 08:30:00 Location 2")

    found_appointments = [
        Appointment(start="2020-02-20 08:30", location="Location 1"),
        Appointment(start="2020-02-20 08:30", location="Location 2"),
        Appointment(start="2020-02-20 12:00"),
    ]
    mocker.patch("where_to.outlook.find_appointments_between",
                 return_value=found_appointments)

    config.which = "next"
    application = Application(config)

    application.run()

    captured = capsys.readouterr()
    assert expected_output == captured.out