diff --git a/bimmer_connected/tests/__init__.py b/bimmer_connected/tests/__init__.py index d7fe4dd1..b7b158f4 100644 --- a/bimmer_connected/tests/__init__.py +++ b/bimmer_connected/tests/__init__.py @@ -22,6 +22,7 @@ VIN_I01_NOREX = "WBY000000NOREXI01" VIN_I01_REX = "WBY00000000REXI01" VIN_I20 = "WBA00000000DEMO01" +VIN_J29 = "WZ100000000000J29" ALL_VEHICLES: Dict[str, Dict] = {brand.value: {} for brand in CarBrands} ALL_PROFILES: Dict[str, Dict] = {} diff --git a/bimmer_connected/tests/responses/toyota-eadrax-vcs_v5_vehicle-list.json b/bimmer_connected/tests/responses/toyota-eadrax-vcs_v5_vehicle-list.json new file mode 100644 index 00000000..0c546925 --- /dev/null +++ b/bimmer_connected/tests/responses/toyota-eadrax-vcs_v5_vehicle-list.json @@ -0,0 +1,4 @@ +{ + "gcid": "ceb64158-d2ca-47e9-9ee6-cbffb881434e", + "mappingInfos": [] +} \ No newline at end of file diff --git a/bimmer_connected/tests/test_account.py b/bimmer_connected/tests/test_account.py index c5067ebc..a040b97e 100644 --- a/bimmer_connected/tests/test_account.py +++ b/bimmer_connected/tests/test_account.py @@ -13,7 +13,7 @@ from bimmer_connected.api.authentication import MyBMWAuthentication, MyBMWLoginRetry from bimmer_connected.api.client import MyBMWClient from bimmer_connected.api.regions import get_region_from_name -from bimmer_connected.const import ATTR_CAPABILITIES, VEHICLES_URL +from bimmer_connected.const import ATTR_CAPABILITIES, VEHICLES_URL, CarBrands from bimmer_connected.models import GPSPosition, MyBMWAPIError, MyBMWAuthError, MyBMWQuotaError from . import ( @@ -448,8 +448,10 @@ async def test_429_retry_ok_vehicles(caplog, bmw_fixture: respx.Router): side_effect=[ httpx.Response(429, json=json_429), httpx.Response(429, json=json_429), - httpx.Response(200, json=load_response(RESPONSE_DIR / "bmw-eadrax-vcs_v5_vehicle-list.json")), - httpx.Response(200, json=load_response(RESPONSE_DIR / "mini-eadrax-vcs_v5_vehicle-list.json")), + *[ + httpx.Response(200, json=load_response(RESPONSE_DIR / f"{brand.value}-eadrax-vcs_v5_vehicle-list.json")) + for brand in CarBrands + ], ] ) caplog.set_level(logging.DEBUG) @@ -498,8 +500,10 @@ async def test_429_retry_with_login_ok_vehicles(bmw_fixture: respx.Router): side_effect=[ httpx.Response(429, json=json_429), httpx.Response(429, json=json_429), - httpx.Response(200, json=load_response(RESPONSE_DIR / "bmw-eadrax-vcs_v5_vehicle-list.json")), - httpx.Response(200, json=load_response(RESPONSE_DIR / "mini-eadrax-vcs_v5_vehicle-list.json")), + *[ + httpx.Response(200, json=load_response(RESPONSE_DIR / f"{brand.value}-eadrax-vcs_v5_vehicle-list.json")) + for brand in CarBrands + ], ] ) diff --git a/bimmer_connected/tests/test_vehicle.py b/bimmer_connected/tests/test_vehicle.py index 967b12fa..2280b90d 100644 --- a/bimmer_connected/tests/test_vehicle.py +++ b/bimmer_connected/tests/test_vehicle.py @@ -18,6 +18,7 @@ VIN_I01_NOREX, VIN_I01_REX, VIN_I20, + VIN_J29, get_deprecation_warning_count, ) from .conftest import prepare_account_with_vehicles @@ -94,6 +95,7 @@ async def test_drive_train_attributes(caplog, bmw_fixture: respx.Router): VIN_I01_NOREX: (False, True), VIN_I01_REX: (True, True), VIN_I20: (False, True), + VIN_J29: (True, False), } for vehicle in account.vehicles: @@ -117,7 +119,6 @@ async def test_parsing_of_lsc_type(caplog, bmw_fixture: respx.Router): def test_car_brand(caplog, bmw_fixture: respx.Router): """Test CarBrand enum.""" assert CarBrands("BMW") == CarBrands("bmw") - assert CarBrands("DRITTKUNDE") == CarBrands("toyota") with pytest.raises(ValueError): CarBrands("Audi") diff --git a/bimmer_connected/tests/test_vehicle_status.py b/bimmer_connected/tests/test_vehicle_status.py index d600e5f3..bc3619e5 100644 --- a/bimmer_connected/tests/test_vehicle_status.py +++ b/bimmer_connected/tests/test_vehicle_status.py @@ -25,6 +25,7 @@ VIN_I01_NOREX, VIN_I01_REX, VIN_I20, + VIN_J29, get_deprecation_warning_count, ) from .conftest import prepare_account_with_vehicles @@ -69,9 +70,16 @@ async def test_generic_error_handling(caplog, bmw_fixture: respx.Router): @pytest.mark.asyncio -async def test_range_combustion_no_info(caplog, bmw_fixture: respx.Router): +@pytest.mark.parametrize( + ("vin"), + [ + (VIN_F31), + (VIN_J29), + ], +) +async def test_range_combustion_no_info(caplog, bmw_fixture: respx.Router, vin: str): """Test if the parsing of very old vehicles.""" - vehicle = (await prepare_account_with_vehicles()).get_vehicle(VIN_F31) + vehicle = (await prepare_account_with_vehicles()).get_vehicle(vin) status = vehicle.fuel_and_battery assert status.remaining_fuel == (None, None)