def test_add_rec(self): """ This test checks model MyRequest and view data frome this model. for next opertion Add 15 record into table DB with timeout 1 sec. After Add, test requests last 10 records. """ for i in range(1, 15): new_rec = MyRequest( query_dt=now(), remote_ip="127.0.0.1", remote_host=str(i), query_string=u"http://localhost/hello/"+str(i) ) new_rec.save() queries = MyRequest.objects.order_by('pk').reverse()[:10] self.assertEqual(queries.count(), 10)