request_profiler.models.ProfilingRecord.objects.get

Here are the examples of the python api request_profiler.models.ProfilingRecord.objects.get taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: django-request-profiler
Source File: tests.py
View license
    def test_rules_match_response(self):
        url = reverse('test_response')
        response = self.client.get(url)
        self.assertTrue(response.has_header('X-Profiler-Duration'))
        record = ProfilingRecord.objects.get()
        self.assertIsNone(record.user)
        # session is save even if user is Anonymous
        self.assertNotEqual(record.session_key, '')
        self.assertEqual(record.http_user_agent, "")
        self.assertEqual(record.http_referer, u'')
        self.assertEqual(record.http_method, 'GET')
        self.assertEqual(record.view_func_name, 'test_response')
        self.assertEqual(str(record.duration), response['X-Profiler-Duration'])
        self.assertEqual(record.response_status_code, 200)

Example 2

Project: django-request-profiler
Source File: tests.py
View license
    def test_rules_match_view(self):
        url = reverse('test_view')
        response = self.client.get(url)
        self.assertTrue(response.has_header('X-Profiler-Duration'))
        record = ProfilingRecord.objects.get()
        self.assertIsNone(record.user)
        self.assertNotEqual(record.session_key, '')
        self.assertEqual(record.http_user_agent, "")
        self.assertEqual(record.http_referer, u'')
        self.assertEqual(record.http_method, 'GET')
        self.assertEqual(record.view_func_name, 'test_view')
        self.assertEqual(str(record.duration), response['X-Profiler-Duration'])
        self.assertEqual(record.response_status_code, 200)

Example 3

Project: django-request-profiler
Source File: tests.py
View license
    def test_rules_match_view_no_session(self):
        url = reverse('test_view')
        settings.STORE_ANONYMOUS_SESSIONS = False
        response = self.client.get(url)
        self.assertTrue(response.has_header('X-Profiler-Duration'))
        record = ProfilingRecord.objects.get()
        self.assertIsNone(record.user)
        self.assertEqual(record.session_key, '')