Exemplo n.º 1
0
def condition_should_have_one_fault_when_a_fault_is_added_test():
    cond = Condition("foo")
    cond.begin()
    cond.add('fault', 'something failed', '123')
    cond.complete()
    ok_(cond.changed())
    values = cond.values()
    eq_(len(values), 1)
    eq_(values[0], '|foo|fault|123|||something failed')
Exemplo n.º 2
0
def condition_should_have_two_faults_when_two_are_added_test():
    cond = Condition("foo")
    cond.begin()
    cond.add('fault', 'something failed', '123')
    cond.add('fault', 'something else failed', '124')
    cond.complete()
    ok_(cond.changed())
    lines = cond.values()
    eq_(len(lines), 2)
    eq_(lines[0], '|foo|fault|123|||something failed')
    eq_(lines[1], '|foo|fault|124|||something else failed')
Exemplo n.º 3
0
def condition_should_be_normal_when_a_fault_is_added_and_then_not_added_again_test():
    cond = Condition("foo")
    cond.begin()
    cond.add('fault', 'something failed', '123')
    cond.complete()
    ok_(cond.changed())
    cond.sweep()
    cond.begin()
    values = cond.values()
    eq_(len(values), 1)
    eq_(values[0], '|foo|normal||||')
Exemplo n.º 4
0
def condition_should_have_one_changed_normal_when_one_fault_is_cleared_test():
    cond = Condition("foo")
    cond.begin()
    cond.add('fault', 'something failed', '123')
    cond.add('fault', 'something else failed', '124')
    cond.sweep()
    ok_(not cond.changed())
    cond.begin()
    cond.add('fault', 'something failed', '123')
    lines = cond.values()
    eq_(len(lines), 1)
    eq_(lines[0], '|foo|normal|124|||')
Exemplo n.º 5
0
def condition_is_unavailable_at_start_test():
    cond = Condition("foo")
    values = cond.values()
    eq_(len(values), 1)
    eq_(values[0], '|foo|UNAVAILABLE||||')