summaryrefslogtreecommitdiff
path: root/validation/test/test_power_strip.py
blob: 73c95ab8920c10f4c54bbc35e57d4a21b7ff862f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8 -*-

import validlib.power_strip as power_strip

def test():
    print "Executing", __file__, "..."
    test_power_strip_control()

def test_power_strip_control():
    subindexes = power_strip.subindexes()
    for index in power_strip.indexes():
        power_strip.switch("off", (index, subindexes))
        for subindex in subindexes:
            key = (index, subindex)
            assert power_strip.status(key) == "off"
            power_strip.switch("on", key)
            assert power_strip.status(key) == "on"
            print "OK: The power plug", key, "can be controlled"
    print "OK: The power strip", index, "can be controlled"