def cond_with_two_faults(): cond = Condition("foo") cond.begin() cond.add('fault', 'something failed', '123') cond.add('fault', 'something else failed', '124') cond.complete() cond.sweep() return cond
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')
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')
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||||')