test_blinds.py•1.42 kB
import time
import pytest
import asyncio
import json
from unittest.mock import patch, mock_open, AsyncMock
import aiohttp
from blinds import set_blinds_state, get_devices
class TestBlindsActions:
def test_all_devices(self):
assert len(get_devices("all", "all", "all")) == 4
def test_top_devices(self):
assert len(get_devices("all", "all", "top")) == 2
def test_bottom_devices(self):
assert len(get_devices("all", "all", "bottom")) == 2
def test_office_devices(self):
assert len(get_devices("all", "office", "all")) == 3
@pytest.mark.asyncio
async def test_open_office(self):
# Test with specific filters
# python command to sell 5 seconds
time.sleep(5)
await set_blinds_state("Open", "sunset", "office", "all")
@pytest.mark.asyncio
async def test_close_office(self):
# Test with specific filters
# python command to sell 5 seconds
time.sleep(5)
await set_blinds_state("Close", "sunset", "office", "all")
@pytest.mark.asyncio
async def test_open1(self):
# Test with specific filters
# python command to sell 5 seconds
time.sleep(5)
await set_blinds_state("Open", "front", "foyer", "top")
@pytest.mark.asyncio
async def test_close1(self):
time.sleep(5)
ret = await set_blinds_state("Open", "front", "foyer", "top")