def test_get_last_history(self): u = User() u.save() s = Scenario(attributes={'id': '111'}, response='bbb') s.save() h = History(scenario=s.to_dict(), user=u) h.save() h = History(scenario=s.to_dict(), user=u) h.save() eq_(h.id, self.client.globals(u.id)['last_history']().id)
def test_isonce_in_history(self): u = User() u.save() s = Scenario(attributes={'id': '111'}, response='bbb') s.save() h = History(scenario=s.to_dict(), user=u) h.save() eq_(False, self.client.globals(u.id)['isonce'](s.attributes['id']))
def test_isonce_in_history_with_time(self): u = User() u.save() s = Scenario(attributes={'id': '111'}, response='bbb') s.save() h = History(scenario=s.to_dict(), user=u) h.save() eq_( False, self.client.globals(u.id)['isonce']( s.attributes['id'], period=datetime.timedelta(seconds=5)))