예제 #1
0
 def test_update_priority(self):
     # check that pk=1 exists, if not - create
     try:
         r = RequestsLogItem.objects.get(pk=1)
     except:
         r = RequestsLogItem(
                 pk=1,
                 path='/',
                 method='GET',
                 META=''
                 )
         r.save()
     def assertPriorityUpdate(self, new_priority):
         self.client.post(reverse('update_priority'), 
                 {
                     'id':1,
                     'priority': new_priority
                 },
                 **{'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'}
                 )
         r = RequestsLogItem.objects.get(pk=1)
         self.assertEqual(r.priority,new_priority)
     new_priority = 0
     assertPriorityUpdate(self, new_priority)
     new_priority = 1
     assertPriorityUpdate(self, new_priority)
예제 #2
0
 def process_request(self, request):
     r = RequestsLogItem(
             path=request.path,
             method=request.method,
             META=request.META
             )
     r.save()
     return None
예제 #3
0
 def test_request_has_default_priority(self):
     r = RequestsLogItem(
             path='/',
             method='GET',
             META=''
             )
     r.save()
     self.assertEqual(r.priority, 1)