def test_drive_train(self): """Tests around drive_train attribute.""" vehicle = ConnectedDriveVehicle(None, G31_VEHICLE) self.assertEqual(DriveTrainType.CONVENTIONAL, vehicle.drive_train) vehicle = ConnectedDriveVehicle(None, F48_VEHICLE) self.assertEqual(DriveTrainType.PHEV, vehicle.drive_train) vehicle = ConnectedDriveVehicle(None, I01_VEHICLE) self.assertEqual(DriveTrainType.BEV, vehicle.drive_train)
def _get_vehicles(self) -> None: """Retrieve list of vehicle for the account.""" _LOGGER.debug('Getting vehicle list') self._get_oauth_token() for brand in CarBrand: response = self.send_request( VEHICLES_URL.format(server=self.server_url), headers=self.request_header(brand), params={ "apptimezone": self.utcdiff, "appDateTime": int(datetime.datetime.now().timestamp() * 1000), "tireGuardMode": "ENABLED" }, logfilename="vehicles_v2_{}".format(brand.value), ) for vehicle_dict in response.json(): # If vehicle already exists, just update it's state existing_vehicle = self.get_vehicle(vehicle_dict["vin"]) if existing_vehicle: existing_vehicle.update_state(vehicle_dict) else: self._vehicles.append( ConnectedDriveVehicle(self, vehicle_dict))
def _get_vehicles(self): """Retrieve list of vehicle for the account.""" _LOGGER.debug('Getting vehicle list') self._get_oauth_token() response = self.send_request(VEHICLES_URL.format(server=self.server_url), headers=self.request_header, logfilename='vehicles') for vehicle_dict in response.json()['vehicles']: self._vehicles.append(ConnectedDriveVehicle(self, vehicle_dict))
def test_has_rex(self): """Tests around hasRex attribute.""" vehicle = ConnectedDriveVehicle(None, G31_VEHICLE) self.assertFalse(vehicle.has_rex) vehicle.attributes['hasRex'] = '1' self.assertTrue(vehicle.has_rex)