def test_smart_task_info():
    """Test gateway info."""
    gateway = Gateway()

    task = SmartTask(gateway, TASK).task_control.tasks[0]
    assert task.id == 65537
    assert task.dimmer == 254
Example #2
0
def test_smart_task_set_start_action_dimmer():
    gateway = Gateway()

    cmd = (SmartTask(
        gateway, TASK).start_action.devices[0].item_controller.set_dimmer(30))

    assert cmd.method == "put"
    assert cmd.path == ["15010", 317094]
    assert cmd.data == {
        "9042": {
            "15013": [
                {
                    "5712": 18000,
                    "5851": 30,
                    "9003": 65537
                },
                {
                    "5712": 18000,
                    "5851": 254,
                    "9003": 65538
                },
            ],
            "5850":
            1,
        }
    }
def test_smart_task_info(mock_api):
    mock_api.mock_request('get', [ROOT_SMART_TASKS, 271141], TASK)
    gateway = Gateway(mock_api)

    task = SmartTask(gateway, TASK).task_control.tasks[0]
    assert task.id == 65537
    assert task.dimmer == 254
Example #4
0
def test_smart_task():
    task = SmartTask(None, TASK)

    assert task.state == 1
    assert task.id == 317094
    assert task.task_type_id == 4
    assert task.repeat_days == 48
    assert task.task_start_time_seconds == 29700
Example #5
0
def test_smart_task():
    gateway = Gateway()
    task = SmartTask(gateway, TASK)
    task1 = SmartTask(gateway, TASK2)
    task2 = SmartTask(gateway, TASK3)

    assert task.state == 1
    assert task.id == 317094
    assert task.task_type_id == 4
    assert task.repeat_days == 48
    assert task.task_start_time == datetime.time(8, 15)
    assert task.task_type_name == "Wake Up"

    assert task1.task_type_id == 2
    assert task1.task_type_name == "Lights Off"

    assert task2.task_type_id == 1
    assert task2.task_type_name == "Not At Home"
def test_smart_task_set_start_action_dimmer(mock_api):
    mock_api.mock_request('get', [ROOT_SMART_TASKS, 271141], TASK)
    gateway = Gateway(mock_api)

    SmartTask(gateway, TASK).start_action.devices[0].\
        item_controller.set_dimmer(30)
    assert len(mock_api.calls) == 1
    req = mock_api.calls[0]
    assert req['method'] == 'put'
Example #7
0
def test_smart_task():
    gateway = Gateway()
    task = SmartTask(gateway, TASK)

    assert task.state == 1
    assert task.id == 317094
    assert task.task_type_id == 4
    assert task.repeat_days == 48
    assert task.task_start_time == datetime.time(8, 15)
def test_smart_task(mock_api):
    mock_api.mock_request('get', [ROOT_SMART_TASKS, 271141], TASK)
    gateway = Gateway(mock_api)
    task = SmartTask(gateway, TASK)

    assert task.state == 1
    assert task.id == 317094
    assert task.task_type_id == 4
    assert task.repeat_days == 48
    assert task.task_start_time == datetime.time(8, 15)
Example #9
0
def test_smart_task_set_start_action_dimmer():
    gateway = Gateway()

    cmd = SmartTask(gateway, TASK).start_action.devices[0]. \
        item_controller.set_dimmer(30)

    assert cmd.method == 'put'
    assert cmd.path == ['15010', 317094]
    assert cmd.data == {
        '9042': {
            '15013': [{
                '5712': 18000,
                '5851': 30,
                '9003': 65537
            }, {
                '5712': 18000,
                '5851': 254,
                '9003': 65538
            }],
            '5850':
            1
        }
    }
Example #10
0
def test_smart_task_info():
    task = SmartTask(None, TASK).task_control.tasks[0]
    assert task.id == 65537
    assert task.dimmer == 254