Repository: bimmerconnected/bimmer_connected
Pull request #525 (2023-04-14 16:17:41)

Update app version to 3.1.0
## Proposed change
<!--
  Describe the big picture of your changes here to communicate to the
  maintainers why we should accept this pull request. If it fixes a bug
  or resolves a feature request, be sure to link to that issue in the
  additional information section.
-->
Updates the app version for all regions and a small URL change for china.

## Type of change
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (which adds functionality to this library)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [x] Code quality improvements to existing code or addition of tests

## Additional information
<!--
  Details are important, and help maintainers processing your PR.
  Please be sure to fill out additional details, if applicable.
-->

- This PR fixes or closes issue: fixes #
- This PR is related to issue: 

## Checklist
<!--
  Put an `x` in the boxes that apply. You can also fill these out after
  creating the PR. If you're unsure about any of them, don't hesitate to ask.
  We're here to help! This is simply a reminder of what we are going to look
  for before merging your code.
-->

- [x] The code change is tested and works locally.
- [x] Tests have been added to verify that the new code works.


codecov[bot]: ## [Codecov](https://codecov.io/gh/bimmerconnected/bimmer_connected/pull/525?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected) Report
Patch and project coverage have no change.
> Comparison is base [(`3e1bb9e`)](https://codecov.io/gh/bimmerconnected/bimmer_connected/commit/3e1bb9e62e6eb476695c362d4a90a488b23bef2d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected) 100.00% compared to head [(`a184bae`)](https://codecov.io/gh/bimmerconnected/bimmer_connected/pull/525?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected) 100.00%.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##            master      #525    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           16        16            
  Lines         1258      1372   +114     
==========================================
+ Hits          1258      1372   +114     
```

| Flag | Coverage Δ | |
|---|---|---|
| 3.10 | `100.00% <ø> (ø)` | |
| 3.11 | `100.00% <ø> (ø)` | |
| 3.7 | `100.00% <ø> (ø)` | |
| 3.8 | `100.00% <ø> (ø)` | |
| 3.9 | `100.00% <ø> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#carryforward-flags-in-the-pull-request-comment) to find out more.

[see 8 files with indirect coverage changes](https://codecov.io/gh/bimmerconnected/bimmer_connected/pull/525/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected)

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected)

</details>

[:umbrella: View full report in Codecov by Sentry](https://codecov.io/gh/bimmerconnected/bimmer_connected/pull/525?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected).


Patch:
diff --git a/bimmer_connected/const.py b/bimmer_connected/const.py
index 5a3c26a..d9be92c 100644
--- a/bimmer_connected/const.py
+++ b/bimmer_connected/const.py
@@ -44,20 +44,20 @@ AES_KEYS = {
 }
 
 APP_VERSIONS = {
-    Regions.NORTH_AMERICA: "2.12.0(19883)",
-    Regions.REST_OF_WORLD: "2.12.0(19883)",
-    Regions.CHINA: "2.3.0(13603)",
+    Regions.NORTH_AMERICA: "3.1.0(20658)",
+    Regions.REST_OF_WORLD: "3.1.0(20658)",
+    Regions.CHINA: "3.1.0(20658)",
 }
 
 HTTPX_TIMEOUT = 30.0
 
-USER_AGENT = "Dart/2.16 (dart:io)"
-X_USER_AGENT = "android(SP1A.210812.016.C1);{brand};{app_version};{region}"
+USER_AGENT = "Dart/2.18 (dart:io)"
+X_USER_AGENT = "android(TQ2A.230405.003.B2);{brand};{app_version};{region}"
 
 
 AUTH_CHINA_PUBLIC_KEY_URL = "/eadrax-coas/v1/cop/publickey"
 AUTH_CHINA_LOGIN_URL = "/eadrax-coas/v2/login/pwd"
-AUTH_CHINA_TOKEN_URL = "/eadrax-coas/v1/oauth/token"
+AUTH_CHINA_TOKEN_URL = "/eadrax-coas/v2/oauth/token"
 
 OAUTH_CONFIG_URL = "/eadrax-ucs/v1/presentation/oauth/config"
 


Test patch:
diff --git a/test/test_account.py b/test/test_account.py
index 13b9c1c..c760106 100644
--- a/test/test_account.py
+++ b/test/test_account.py
@@ -110,7 +110,7 @@ def account_mock():
     router.post("/eadrax-coas/v2/login/pwd").respond(
         200, json=load_response(RESPONSE_DIR / "auth" / "auth_cn_login_pwd.json")
     )
-    router.post("/eadrax-coas/v1/oauth/token").respond(
+    router.post("/eadrax-coas/v2/oauth/token").respond(
         200, json=load_response(RESPONSE_DIR / "auth" / "auth_token.json")
     )
 
@@ -262,7 +262,7 @@ async def test_login_refresh_token_china_401():
 async def test_login_refresh_token_china_invalid(caplog):
     """Test the login flow using refresh_token."""
     with account_mock() as mock_api:
-        mock_api.post("/eadrax-coas/v1/oauth/token").mock(
+        mock_api.post("/eadrax-coas/v2/oauth/token").mock(
             side_effect=[
                 httpx.Response(400),
                 httpx.Response(200, json=load_response(RESPONSE_DIR / "auth" / "auth_token.json")),