Exemple #1
0
async def test_get_charge_history_day(vehicle: RenaultVehicle,
                                      mocked_responses: aioresponses) -> None:
    """Test get_charge_history."""
    fixtures.inject_get_charge_history(mocked_responses, "20201001",
                                       "20201115", "day")
    assert await vehicle.get_charge_history(
        start=datetime(2020, 10, 1),
        end=datetime(2020, 11, 15),
        period="day",
    )
Exemple #2
0
def test_charge_history_month(mocked_responses: aioresponses,
                              cli_runner: CliRunner) -> None:
    """It exits with a status code of zero."""
    initialise_credential_store(include_account_id=True, include_vin=True)
    fixtures.inject_get_charge_history(mocked_responses,
                                       start="202011",
                                       end="202011",
                                       period="month")

    result = cli_runner.invoke(
        __main__.main, "charge history --from 2020-11-01 --to 2020-11-30")
    assert result.exit_code == 0, result.exception

    expected_output = (
        "  Month    Number of charges  Total time charging      Errors\n"
        "-------  -------------------  ---------------------  --------\n"
        " 202011                    1  7:59:00                       0\n")
    assert expected_output == result.output