def test_triggerruleds_insert_last(self): """ Trigger rules insert_first puts new rows last""" first_row = model.TriggerRule() second_row = model.TriggerRule() self.obj.insert(0, first_row) eq_(len(self.obj.rules), 1) eq_(first_row.position, 0) self.obj.append(second_row) eq_(len(self.obj.rules), 2) eq_(first_row.position, 0) eq_(second_row.position, 1)
def create_triggers(self): for trigger in database_data.triggers: t = model.Trigger() (t.display_name, t.email_owner, t.email_users, t.subject, t.body, rules) = trigger for rule in rules: r = model.TriggerRule() (field, r.oper, limits, r.stop, r.and_rule) = rule r.set_field(field) r.set_limit(limits) t.append(r) model.DBSession.add(t)
def test_init_rule_bad_field(self): """ TriggerRule init with bad field name raises ValueError """ new_rule = model.TriggerRule(field='BAD')
def test_init_rule_field(self): """ TriggerRule with field sets field """ new_rule = model.TriggerRule(field='attribute_name') eq_(new_rule.field, 1)