def test_calls_next_validator(self): clt = ChangeTracker(ChangeHistory.configure("history"), next_validator = lambda ob, attr, v: v*2) class B(self.A): textval = Unicode(validator=clt) b = B() b.textval = u'bork' assert b.textval == u'borkbork'
def test_cuser_set(self): def getuser(): return u'Fred' history = ChangeHistory.configure("history", getuser=getuser, usertype=Unicode) class B(self.A): textval = Unicode(validator=ChangeTracker(history)) b = self.store.add(B()) b.textval = u'foo' changes = self.store.find(history) assert_equal(changes[0].cuser, u'Fred')
def test_configure_returns_instance_with_correct_storm_table(self): mychangehistory = ChangeHistory.configure('xyzzy') assert issubclass(mychangehistory, ChangeHistory) assert_equal(mychangehistory.__storm_table__, 'xyzzy')