diff --git a/poetry.lock b/poetry.lock index a444b661..806ad94d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -138,13 +138,13 @@ frozenlist = ">=1.1.0" [[package]] name = "anyio" -version = "4.4.0" +version = "4.5.0" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = true python-versions = ">=3.8" files = [ - {file = "anyio-4.4.0-py3-none-any.whl", hash = "sha256:c1b2d8f46a8a812513012e1107cb0e68c17159a7a594208005a57dc776e1bdc7"}, - {file = "anyio-4.4.0.tar.gz", hash = "sha256:5aadc6a1bbb7cdb0bede386cac5e2940f5e2ff3aa20277e991cf028e0585ce94"}, + {file = "anyio-4.5.0-py3-none-any.whl", hash = "sha256:fdeb095b7cc5a5563175eedd926ec4ae55413bb4be5770c424af0ba46ccb4a78"}, + {file = "anyio-4.5.0.tar.gz", hash = "sha256:c5a275fe5ca0afd788001f58fca1e69e29ce706d746e317d660e21f70c530ef9"}, ] [package.dependencies] @@ -152,9 +152,9 @@ idna = ">=2.8" sniffio = ">=1.1" [package.extras] -doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (>=0.23)"] +doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.21.0b1)"] +trio = ["trio (>=0.26.1)"] [[package]] name = "asyncclick" @@ -242,7 +242,7 @@ lxml = ["lxml"] name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." -optional = true +optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, @@ -380,6 +380,17 @@ files = [ [package.extras] all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "multidict" version = "6.1.0" @@ -492,6 +503,17 @@ files = [ {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, ] +[[package]] +name = "packaging" +version = "24.1" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, + {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, +] + [[package]] name = "paho-mqtt" version = "1.6.1" @@ -505,6 +527,21 @@ files = [ [package.extras] proxy = ["PySocks"] +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + [[package]] name = "pydantic" version = "1.10.18" @@ -583,27 +620,27 @@ tests = ["coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)"] [[package]] name = "pyreadline3" -version = "3.5.2" +version = "3.5.4" description = "A python implementation of GNU readline." optional = true python-versions = ">=3.8" files = [ - {file = "pyreadline3-3.5.2-py3-none-any.whl", hash = "sha256:a87d56791e2965b2b187e2ea33dcf664600842c997c0623c95cf8ef07db83de9"}, - {file = "pyreadline3-3.5.2.tar.gz", hash = "sha256:ba82292e52c5a3bb256b291af0c40b457c1e8699cac9a873abbcaac8aef3a1bb"}, + {file = "pyreadline3-3.5.4-py3-none-any.whl", hash = "sha256:eaf8e6cc3c49bcccf145fc6067ba8643d1df34d604a1ec0eccbf7a18e6d3fae6"}, + {file = "pyreadline3-3.5.4.tar.gz", hash = "sha256:8d57d53039a1c75adba8e50dd3d992b28143480816187ea5efbd5c78e6c885b7"}, ] [package.extras] -dev = ["build", "flake8", "pytest", "twine"] +dev = ["build", "flake8", "mypy", "pytest", "twine"] [[package]] name = "pyright" -version = "1.1.380" +version = "1.1.381" description = "Command line wrapper for pyright" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.380-py3-none-any.whl", hash = "sha256:a6404392053d8848bacc7aebcbd9d318bb46baf1a1a000359305481920f43879"}, - {file = "pyright-1.1.380.tar.gz", hash = "sha256:e6ceb1a5f7e9f03106e0aa1d6fbb4d97735a5e7ffb59f3de6b2db590baf935b2"}, + {file = "pyright-1.1.381-py3-none-any.whl", hash = "sha256:5dc0aa80a265675d36abab59c674ae01dbe476714f91845b61b841d34aa99081"}, + {file = "pyright-1.1.381.tar.gz", hash = "sha256:314cf0c1351c189524fb10c7ac20688ecd470e8cc505c394d642c9c80bf7c3a5"}, ] [package.dependencies] @@ -613,6 +650,44 @@ nodeenv = ">=1.6.0" all = ["twine (>=3.4.1)"] dev = ["twine (>=3.4.1)"] +[[package]] +name = "pytest" +version = "8.3.3" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"}, + {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.5,<2" + +[package.extras] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-asyncio" +version = "0.24.0" +description = "Pytest support for asyncio" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest_asyncio-0.24.0-py3-none-any.whl", hash = "sha256:a811296ed596b69bf0b6f3dc40f83bcaf341b155a269052d82efa2b25ac7037b"}, + {file = "pytest_asyncio-0.24.0.tar.gz", hash = "sha256:d081d828e576d85f875399194281e92bf8a68d60d72d1a2faf2feddb6c46b276"}, +] + +[package.dependencies] +pytest = ">=8.2,<9" + +[package.extras] +docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] +testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"] + [[package]] name = "pyyaml" version = "6.0.2" @@ -677,29 +752,29 @@ files = [ [[package]] name = "ruff" -version = "0.6.5" +version = "0.6.6" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.6.5-py3-none-linux_armv6l.whl", hash = "sha256:7e4e308f16e07c95fc7753fc1aaac690a323b2bb9f4ec5e844a97bb7fbebd748"}, - {file = "ruff-0.6.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:932cd69eefe4daf8c7d92bd6689f7e8182571cb934ea720af218929da7bd7d69"}, - {file = "ruff-0.6.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:3a8d42d11fff8d3143ff4da41742a98f8f233bf8890e9fe23077826818f8d680"}, - {file = "ruff-0.6.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a50af6e828ee692fb10ff2dfe53f05caecf077f4210fae9677e06a808275754f"}, - {file = "ruff-0.6.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:794ada3400a0d0b89e3015f1a7e01f4c97320ac665b7bc3ade24b50b54cb2972"}, - {file = "ruff-0.6.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:381413ec47f71ce1d1c614f7779d88886f406f1fd53d289c77e4e533dc6ea200"}, - {file = "ruff-0.6.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:52e75a82bbc9b42e63c08d22ad0ac525117e72aee9729a069d7c4f235fc4d276"}, - {file = "ruff-0.6.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:09c72a833fd3551135ceddcba5ebdb68ff89225d30758027280968c9acdc7810"}, - {file = "ruff-0.6.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:800c50371bdcb99b3c1551d5691e14d16d6f07063a518770254227f7f6e8c178"}, - {file = "ruff-0.6.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e25ddd9cd63ba1f3bd51c1f09903904a6adf8429df34f17d728a8fa11174253"}, - {file = "ruff-0.6.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:7291e64d7129f24d1b0c947ec3ec4c0076e958d1475c61202497c6aced35dd19"}, - {file = "ruff-0.6.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:9ad7dfbd138d09d9a7e6931e6a7e797651ce29becd688be8a0d4d5f8177b4b0c"}, - {file = "ruff-0.6.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:005256d977021790cc52aa23d78f06bb5090dc0bfbd42de46d49c201533982ae"}, - {file = "ruff-0.6.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:482c1e6bfeb615eafc5899127b805d28e387bd87db38b2c0c41d271f5e58d8cc"}, - {file = "ruff-0.6.5-py3-none-win32.whl", hash = "sha256:cf4d3fa53644137f6a4a27a2b397381d16454a1566ae5335855c187fbf67e4f5"}, - {file = "ruff-0.6.5-py3-none-win_amd64.whl", hash = "sha256:3e42a57b58e3612051a636bc1ac4e6b838679530235520e8f095f7c44f706ff9"}, - {file = "ruff-0.6.5-py3-none-win_arm64.whl", hash = "sha256:51935067740773afdf97493ba9b8231279e9beef0f2a8079188c4776c25688e0"}, - {file = "ruff-0.6.5.tar.gz", hash = "sha256:4d32d87fab433c0cf285c3683dd4dae63be05fd7a1d65b3f5bf7cdd05a6b96fb"}, + {file = "ruff-0.6.6-py3-none-linux_armv6l.whl", hash = "sha256:f5bc5398457484fc0374425b43b030e4668ed4d2da8ee7fdda0e926c9f11ccfb"}, + {file = "ruff-0.6.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:515a698254c9c47bb84335281a170213b3ee5eb47feebe903e1be10087a167ce"}, + {file = "ruff-0.6.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6bb1b4995775f1837ab70f26698dd73852bbb82e8f70b175d2713c0354fe9182"}, + {file = "ruff-0.6.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69c546f412dfae8bb9cc4f27f0e45cdd554e42fecbb34f03312b93368e1cd0a6"}, + {file = "ruff-0.6.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:59627e97364329e4eae7d86fa7980c10e2b129e2293d25c478ebcb861b3e3fd6"}, + {file = "ruff-0.6.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:94c3f78c3d32190aafbb6bc5410c96cfed0a88aadb49c3f852bbc2aa9783a7d8"}, + {file = "ruff-0.6.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:704da526c1e137f38c8a067a4a975fe6834b9f8ba7dbc5fd7503d58148851b8f"}, + {file = "ruff-0.6.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:efeede5815a24104579a0f6320660536c5ffc1c91ae94f8c65659af915fb9de9"}, + {file = "ruff-0.6.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e368aef0cc02ca3593eae2fb8186b81c9c2b3f39acaaa1108eb6b4d04617e61f"}, + {file = "ruff-0.6.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2653fc3b2a9315bd809725c88dd2446550099728d077a04191febb5ea79a4f79"}, + {file = "ruff-0.6.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:bb858cd9ce2d062503337c5b9784d7b583bcf9d1a43c4df6ccb5eab774fbafcb"}, + {file = "ruff-0.6.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:488f8e15c01ea9afb8c0ba35d55bd951f484d0c1b7c5fd746ce3c47ccdedce68"}, + {file = "ruff-0.6.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:aefb0bd15f1cfa4c9c227b6120573bb3d6c4ee3b29fb54a5ad58f03859bc43c6"}, + {file = "ruff-0.6.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:a4c0698cc780bcb2c61496cbd56b6a3ac0ad858c966652f7dbf4ceb029252fbe"}, + {file = "ruff-0.6.6-py3-none-win32.whl", hash = "sha256:aadf81ddc8ab5b62da7aae78a91ec933cbae9f8f1663ec0325dae2c364e4ad84"}, + {file = "ruff-0.6.6-py3-none-win_amd64.whl", hash = "sha256:0adb801771bc1f1b8cf4e0a6fdc30776e7c1894810ff3b344e50da82ef50eeb1"}, + {file = "ruff-0.6.6-py3-none-win_arm64.whl", hash = "sha256:4b4d32c137bc781c298964dd4e52f07d6f7d57c03eae97a72d97856844aa510a"}, + {file = "ruff-0.6.6.tar.gz", hash = "sha256:0fc030b6fd14814d69ac0196396f6761921bd20831725c7361e1b8100b818034"}, ] [[package]] @@ -860,4 +935,4 @@ cli = ["asyncclick", "coloredlogs", "termcolor"] [metadata] lock-version = "2.0" python-versions = ">=3.12.0" -content-hash = "168bb6daa51cd3bc2d8f7940e05f8efac0e85a4be682ea3fa01ef16a78ae8d15" +content-hash = "9c7ee0f6a75190e589f509a3ccba880d5bdbf723c0b9cf2d111fd7c9330cfa7b" diff --git a/pyproject.toml b/pyproject.toml index 80c50a1d..e0cf3d73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,22 +6,24 @@ authors = ["Frederick Gnodtke "] readme = "README.md" [tool.poetry.dependencies] -python = ">=3.12.0" -beautifulsoup4 = "^4" aiohttp = "^3" +asyncclick = { version = "^8.1.7.2", optional = true } +asyncio = "^3" +asyncio-paho = "^0.6.0" +beautifulsoup4 = "^4" +coloredlogs = { version = "^15.0.1", optional = true } +paho-mqtt = "^1" +pydantic = "^1" pyjwt = "^2" +python = ">=3.12.0" pyyaml = "^6" -pydantic = "^1" -asyncio = "^3" -asyncclick = { version = "^8.1.7.2", optional = true } termcolor = { version = "^2.4.0", optional = true } -paho-mqtt = "^1" -coloredlogs = {version = "^15.0.1", optional = true} -asyncio-paho = "^0.6.0" [tool.poetry.group.dev.dependencies] -ruff = "^0.6.4" pyright = "^1.1.379" +pytest = "^8" +pytest-asyncio = "^0" +ruff = "^0.6.4" [tool.poetry.scripts] myskoda = "myskoda.cli:cli" @@ -30,15 +32,14 @@ myskoda = "myskoda.cli:cli" cli = ["asyncclick", "coloredlogs", "termcolor"] [build-system] -requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" +requires = ["poetry-core"] [tool.ruff] -target-version = "py312" line-length = 100 +target-version = "py312" [tool.ruff.lint] -select = ["ALL"] ignore = [ "COM812", # missing-trailing-comma "D101", # undocumented-public-class @@ -46,10 +47,12 @@ ignore = [ "D203", # one-blank-line-before-class "D211", # blank-line-before-class "D213", # multi-line-summary-second-line + "FBT001", # boolean-type-hint-positional-argument "FIX002", # line-contains-todo "G004", # logging-f-string "ISC001", # single-line-implicit-string-concatenation + "S101", # assert (used in tests) "T201", # print "TD003", # missing-todo-link - "FBT001", # boolean-type-hint-positional-argument ] +select = ["ALL"] diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..d420712d --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +"""Tests.""" diff --git a/tests/fixtures/enyaq/garage_vehicles_iv80.json b/tests/fixtures/enyaq/garage_vehicles_iv80.json new file mode 100644 index 00000000..9671a9d2 --- /dev/null +++ b/tests/fixtures/enyaq/garage_vehicles_iv80.json @@ -0,0 +1,382 @@ +{ + "vin": "TMBJM0CKV1N12345", + "name": "Enyaq", + "workshopModeEnabled": false, + "licensePlate": "ABC123", + "state": "ACTIVATED", + "devicePlatform": "WCAR", + "softwareVersion": "3.7", + "specification": { + "title": "Škoda Enyaq", + "manufacturingDate": "2022-07-01", + "model": "Enyaq", + "modelYear": "2022", + "body": "SUV", + "trimLevel": "80", + "systemCode": "UNKNOWN", + "systemModelId": "5AZJJ2", + "maxChargingPowerInKW": 125, + "battery": { + "capacityInKWh": 77 + }, + "engine": { + "type": "iV", + "powerInKW": 150 + }, + "gearbox": { + "type": "E1H" + } + }, + "servicePartner": { + "servicePartnerId": "BELC34020" + }, + "renders": [ + { + "url": "https://iprenders.blob.core.windows.net/base5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-19201080dayvext_side1080.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 0 + }, + { + "url": "https://ip-modcwp.azureedge.net/modcwp5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-1920658dayvext_side1080.png?v=638184379160000000", + "viewPoint": "garage_l", + "type": "REAL", + "order": 1 + }, + { + "url": "https://ip-modcwp.azureedge.net/modcwp5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-700390dayvext_front1080.png?v=637969333900000000", + "viewPoint": "main", + "type": "REAL", + "order": 2 + } + ], + "compositeRenders": [ + { + "layers": [ + { + "url": "https://iprenders.blob.core.windows.net/base5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-19201080dayvext_side1080.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 0 + } + ], + "viewType": "UNMODIFIED_EXTERIOR_SIDE" + }, + { + "layers": [ + { + "url": "https://iprenders.blob.core.windows.net/base5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-19201080dayvext_side1080.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 0 + } + ], + "modifications": { + "adjustSpaceInPx": { + "top": -317, + "bottom": -193, + "left": -149, + "right": -111 + }, + "densityIndependentHeight": 270, + "flipHorizontal": false, + "anchorTo": "LEFT" + }, + "viewType": "HOME" + }, + { + "layers": [ + { + "url": "https://iprenders.blob.core.windows.net/base5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-19201080dayvext_side1080.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 0 + }, + { + "url": "https://mspgwlivestorage.blob.core.windows.net/renders/cables/enyaq_5A_cable_charging_light_v1.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 1 + } + ], + "modifications": { + "adjustSpaceInPx": { + "top": -317, + "bottom": -193, + "left": -149, + "right": -111 + }, + "densityIndependentHeight": 270, + "flipHorizontal": true, + "anchorTo": "LEFT" + }, + "viewType": "CHARGING_LIGHT" + }, + { + "layers": [ + { + "url": "https://iprenders.blob.core.windows.net/base5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-19201080dayvext_side1080.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 0 + }, + { + "url": "https://mspgwlivestorage.blob.core.windows.net/renders/cables/enyaq_5A_cable_charging_dark_v1.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 1 + } + ], + "modifications": { + "adjustSpaceInPx": { + "top": -317, + "bottom": -193, + "left": -149, + "right": -111 + }, + "densityIndependentHeight": 270, + "flipHorizontal": true, + "anchorTo": "LEFT" + }, + "viewType": "CHARGING_DARK" + }, + { + "layers": [ + { + "url": "https://iprenders.blob.core.windows.net/base5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-19201080dayvext_side1080.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 0 + }, + { + "url": "https://mspgwlivestorage.blob.core.windows.net/renders/cables/enyaq_5A_cable_plugged_in_light_v1.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 1 + } + ], + "modifications": { + "adjustSpaceInPx": { + "top": -317, + "bottom": -193, + "left": -149, + "right": -111 + }, + "densityIndependentHeight": 270, + "flipHorizontal": true, + "anchorTo": "LEFT" + }, + "viewType": "PLUGGED_IN_LIGHT" + }, + { + "layers": [ + { + "url": "https://iprenders.blob.core.windows.net/base5azs22200218/8X8XdPgci_nZToLW-5ULF6ayj.sgCneqdDwt0-QxJv4obND1itVKA7q5X.UlSY-li0Lfv2.O4_SdInzqCbaYBos8Ww-B-19201080dayvext_side1080.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 0 + }, + { + "url": "https://mspgwlivestorage.blob.core.windows.net/renders/cables/enyaq_5A_cable_plugged_in_dark_v1.png", + "viewPoint": "exterior_side", + "type": "REAL", + "order": 1 + } + ], + "modifications": { + "adjustSpaceInPx": { + "top": -317, + "bottom": -193, + "left": -149, + "right": -111 + }, + "densityIndependentHeight": 270, + "flipHorizontal": true, + "anchorTo": "LEFT" + }, + "viewType": "PLUGGED_IN_DARK" + } + ], + "capabilities": { + "capabilities": [ + { + "id": "AUTOMATION", + "statuses": [] + }, + { + "id": "BATTERY_CHARGING_CARE", + "statuses": [] + }, + { + "id": "BATTERY_SUPPORT", + "statuses": [] + }, + { + "id": "CHARGING_PROFILES", + "statuses": [] + }, + { + "id": "CHARGING_STATIONS", + "statuses": [] + }, + { + "id": "DEALER_APPOINTMENT", + "statuses": [] + }, + { + "id": "DIGICERT", + "statuses": [] + }, + { + "id": "MAP_UPDATE", + "statuses": [] + }, + { + "id": "MEASUREMENTS", + "statuses": [] + }, + { + "id": "PARKING_INFORMATION", + "statuses": [] + }, + { + "id": "PARKING_POSITION", + "statuses": [] + }, + { + "id": "PLUG_AND_CHARGE", + "statuses": [ + "DEACTIVATED_BY_ACTIVE_VEHICLE_USER" + ] + }, + { + "id": "POI_SEARCH", + "statuses": [] + }, + { + "id": "ROADSIDE_ASSISTANT", + "statuses": [] + }, + { + "id": "ROUTING", + "statuses": [] + }, + { + "id": "STATE", + "statuses": [] + }, + { + "id": "TRAFFIC_INFORMATION", + "statuses": [] + }, + { + "id": "VEHICLE_HEALTH_INSPECTION", + "statuses": [] + }, + { + "id": "WARNING_LIGHTS", + "statuses": [] + }, + { + "id": "WEB_RADIO", + "statuses": [] + }, + { + "id": "AIR_CONDITIONING_TIMERS", + "statuses": [] + }, + { + "id": "AIR_CONDITIONING_SMART_SETTINGS", + "statuses": [] + }, + { + "id": "POWERPASS_TARIFFS", + "statuses": [] + }, + { + "id": "AIR_CONDITIONING_SAVE_AND_ACTIVATE", + "statuses": [] + }, + { + "id": "CUBIC", + "statuses": [] + }, + { + "id": "ROUTE_PLANNING_5_CHARGERS", + "statuses": [] + }, + { + "id": "SUBSCRIPTIONS", + "statuses": [] + }, + { + "id": "DESTINATIONS", + "statuses": [] + }, + { + "id": "CHARGING_MEB", + "statuses": [] + }, + { + "id": "VEHICLE_SERVICES_BACKUPS", + "statuses": [] + }, + { + "id": "EV_ROUTE_PLANNING", + "statuses": [] + }, + { + "id": "CHARGE_MODE_SELECTION", + "statuses": [] + }, + { + "id": "DIGICERT", + "statuses": [] + }, + { + "id": "VEHICLE_HEALTH_WARNINGS", + "statuses": [] + }, + { + "id": "PAY_TO_PARK", + "statuses": [] + }, + { + "id": "ONLINE_SPEECH_GPS", + "statuses": [] + }, + { + "id": "GUEST_USER_MANAGEMENT", + "statuses": [] + }, + { + "id": "SERVICE_PARTNER", + "statuses": [] + }, + { + "id": "WINDOW_HEATING", + "statuses": [] + }, + { + "id": "ROUTE_IMPORT", + "statuses": [] + }, + { + "id": "CHARGING", + "statuses": [] + }, + { + "id": "AIR_CONDITIONING", + "statuses": [] + }, + { + "id": "EXTENDED_CHARGING_SETTINGS", + "statuses": [] + }, + { + "id": "VEHICLE_WAKE_UP_TRIGGER", + "statuses": [] + } + ] + } +} diff --git a/tests/test_rest_api.py b/tests/test_rest_api.py new file mode 100644 index 00000000..6d17d99c --- /dev/null +++ b/tests/test_rest_api.py @@ -0,0 +1,44 @@ +"""Unit tests for myskoda.rest_api.""" + +import json +from pathlib import Path +from unittest.mock import ANY, AsyncMock, MagicMock + +import pytest + +from myskoda import RestApi + +FIXTURES_DIR = Path(__file__).parent.joinpath("fixtures") + +print(f"__file__ = {__file__}") + + +@pytest.fixture(name="vehicle_info") +def load_vehicle_info() -> bytes: + """Load vehicle-info fixture.""" + with FIXTURES_DIR.joinpath("enyaq/garage_vehicles_iv80.json").open() as file: + return file.read() + + +@pytest.mark.asyncio +async def test_get_info(vehicle_info: bytes) -> None: + """Example unit test for RestAPI.get_info(). Needs more work.""" + vehicle_info_json = json.loads(vehicle_info) + response_mock = AsyncMock() + response_mock.text.return_value = vehicle_info + session_mock = MagicMock() + session_mock.get.return_value.__aenter__.return_value = response_mock + + api = RestApi(session=session_mock) + api.idk_session = AsyncMock() + get_info_result = await api.get_info(vehicle_info_json["vin"]) + + # Should probabaly assert the whole thing. Just an example. + assert get_info_result.name == vehicle_info_json["name"] + + session_mock.get.assert_called_with( + "https://mysmob.api.connect.skoda-auto.cz/api/v2/garage/vehicles/TMBJM0CKV1N12345" + "?connectivityGenerations=MOD1&connectivityGenerations=MOD2&connectivityGenerations=MOD3" + "&connectivityGenerations=MOD4", + headers=ANY, + )