Ejemplo n.º 1
0
 def test_client_globals_history_with_user(self):
     u = User()
     h = History()
     h.user = u
     h.scenario = {"response": "aaa"}
     u.save()
     h.save()
     u = User()
     h = History()
     h.user = u
     h.scenario = {"response": "aaa"}
     u.save()
     h.save()
     eq_(len(History.objects()), 2)
     eq_(len(self.client.globals(u.id)["history"]), 1)
Ejemplo n.º 2
0
 def test_add_history(self):
     u = User()
     h = History()
     h.user = u
     h.scenario = {"response": "aaa"}
     u.save()
     h.save()
     eq_(h.id, History.objects().only('id').first().id)
Ejemplo n.º 3
0
 def test_client_globals_history(self):
     u = User()
     h = History()
     h.user = u
     h.scenario = {"response": "aaa"}
     u.save()
     h.save()
     eq_(u.id,
         self.client.globals(u.id)["history"].only('user').first().user.id)
Ejemplo n.º 4
0
 def test_add_history_check_created_at(self):
     u = User()
     h = History()
     h.user = u
     h.scenario = {"response": "aaa"}
     u.save()
     h.save()
     utc = datetime.datetime.utcnow()
     ok_(utc >= h.created_at >= utc - datetime.timedelta(seconds=1))
Ejemplo n.º 5
0
 def test_add_history_no_user(self):
     h = History()
     h.scenario = {"response": "aaa"}
     h.save()