Browse Source

test _mac_address_valid

Fabian Peter Hammerle 4 years ago
parent
commit
9f97184463
1 changed files with 18 additions and 0 deletions
  1. 18 0
      tests/test_mac_address.py

+ 18 - 0
tests/test_mac_address.py

@@ -0,0 +1,18 @@
+import pytest
+
+import switchbot_mqtt
+
+
+@pytest.mark.parametrize(
+    ("mac_address", "valid"),
+    [
+        ("aa:bb:cc:dd:ee:ff", True),
+        ("AA:BB:CC:DD:EE:FF", True),
+        ("AA:12:34:45:67:89", True),
+        ("aabbccddeeff", False),  # not supported by PySwitchbot
+        ("aa:bb:cc:dd:ee:gg", False),
+    ],
+)
+def test__mac_address_valid(mac_address, valid):
+    # pylint: disable=protected-access
+    assert switchbot_mqtt._mac_address_valid(mac_address) == valid