From ce405907a0e5e8f20d77182bcff0d4982f50daac Mon Sep 17 00:00:00 2001 From: Tomasz Date: Wed, 27 Nov 2024 16:41:40 +0100 Subject: [PATCH] Version bump to 0.3.1 --- custom_components/enpal/manifest.json | 2 +- custom_components/enpal/sensor.py | 2 +- custom_components/enpal/tests/__init__.py | 0 custom_components/enpal/tests/test_sensor.py | 47 -------------------- 4 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 custom_components/enpal/tests/__init__.py delete mode 100644 custom_components/enpal/tests/test_sensor.py diff --git a/custom_components/enpal/manifest.json b/custom_components/enpal/manifest.json index 367e331..936a761 100644 --- a/custom_components/enpal/manifest.json +++ b/custom_components/enpal/manifest.json @@ -7,5 +7,5 @@ "requirements": [], "iot_class": "local_polling", "config_flow": true, - "version": "0.3.0" + "version": "0.3.1" } \ No newline at end of file diff --git a/custom_components/enpal/sensor.py b/custom_components/enpal/sensor.py index c30cec8..cef4645 100644 --- a/custom_components/enpal/sensor.py +++ b/custom_components/enpal/sensor.py @@ -18,7 +18,7 @@ _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(seconds=120) -VERSION= '0.3.0' +VERSION= '0.3.1' def get_tables(ip: str, port: int, token: str): client = InfluxDBClient(url=f'http://{ip}:{port}', token=token, org='enpal') diff --git a/custom_components/enpal/tests/__init__.py b/custom_components/enpal/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/custom_components/enpal/tests/test_sensor.py b/custom_components/enpal/tests/test_sensor.py deleted file mode 100644 index 97ab594..0000000 --- a/custom_components/enpal/tests/test_sensor.py +++ /dev/null @@ -1,47 +0,0 @@ -import unittest -import custom_components.enpal.sensor as sensor - -class IPSensorTest(unittest.IsolatedAsyncioTestCase): - def setUp(self) -> None: - self.ipv4 = sensor.IPSensor(False) - self.ipv6 = sensor.IPSensor(True) - - def test_validate_ipv4(self): - assert sensor.validate_ipv4('192.168.0.1') - assert sensor.validate_ipv4('123.123.123.123') - assert not sensor.validate_ipv4('300.0.0.1') - assert not sensor.validate_ipv4('300.0.0.-1') - assert not sensor.validate_ipv4('2001:0db8:85a3:0000:0000:8a2e:0370:7334') - assert not sensor.validate_ipv4('1.2.3') - assert not sensor.validate_ipv4('1.2.3.4.5') - assert not sensor.validate_ipv4('abc.def.ghi.jkl') - assert not sensor.validate_ipv4('192.168.abc.def') - assert not sensor.validate_ipv4('') - - def test_validate_ipv6(self): - assert sensor.validate_ipv6('2001:db8::2:1') - assert not sensor.validate_ipv6('2001::2:1') - assert sensor.validate_ipv6('2001:0db8:85a3:0000:0000:8a2e:0370:7334') - assert not sensor.validate_ipv6('2001:0db8:85a3:00000:0000:8a2e:0370:7334') - assert not sensor.validate_ipv6('2001:0db8:85a3:0000:0000:8a2e:0370:ghij') - assert not sensor.validate_ipv6('300.0.0.1') - assert not sensor.validate_ipv6('300.0.0.-1') - assert not sensor.validate_ipv6('192.168.0.1') - assert not sensor.validate_ipv6('1.2.3') - assert not sensor.validate_ipv6('1.2.3.4.5') - assert not sensor.validate_ipv6('') - - async def test_update_ipv4(self): - await self.ipv4.async_update() - if self.ipv4.native_value == None: - return # skip tests if no ipv4 address is found (dev is offline?) - assert sensor.validate_ipv4(self.ipv4.native_value) - - async def test_update_ipv6(self): - await self.ipv6.async_update() - if self.ipv6.native_value == None: - return # skip tests if no ipv6 address is found (dev is offline or uses only ipv4?) - assert len(self.ipv6.native_value) > 5 - isv4 = sensor.validate_ipv4(self.ipv6.native_value) - if not isv4: - assert sensor.validate_ipv6(self.ipv6.native_value)