mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
d890b0a3ac
Some checks are pending
CI / Perform linting checks (3.13) (push) Waiting to run
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Blocked by required conditions
CodeQL checks / Analyze (python) (push) Waiting to run
- Motion detection - Person detection - Tamper detection - Baby Cry Detection
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
"""Tests for smartcam tamper detection module."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from kasa import Device
|
|
from kasa.smartcam.smartcammodule import SmartCamModule
|
|
|
|
from ...device_fixtures import parametrize
|
|
|
|
tamperdetection = parametrize(
|
|
"has tamper detection",
|
|
component_filter="tamperDetection",
|
|
protocol_filter={"SMARTCAM"},
|
|
)
|
|
|
|
|
|
@tamperdetection
|
|
async def test_tamperdetection(dev: Device):
|
|
"""Test device tamper detection."""
|
|
tamper = dev.modules.get(SmartCamModule.SmartCamTamperDetection)
|
|
assert tamper
|
|
|
|
tde_feat = dev.features.get("tamper_detection")
|
|
assert tde_feat
|
|
|
|
original_enabled = tamper.enabled
|
|
|
|
try:
|
|
await tamper.set_enabled(not original_enabled)
|
|
await dev.update()
|
|
assert tamper.enabled is not original_enabled
|
|
assert tde_feat.value is not original_enabled
|
|
|
|
await tamper.set_enabled(original_enabled)
|
|
await dev.update()
|
|
assert tamper.enabled is original_enabled
|
|
assert tde_feat.value is original_enabled
|
|
|
|
await tde_feat.set_value(not original_enabled)
|
|
await dev.update()
|
|
assert tamper.enabled is not original_enabled
|
|
assert tde_feat.value is not original_enabled
|
|
|
|
finally:
|
|
await tamper.set_enabled(original_enabled)
|