# Path: audit/models.py
# class PageviewRecord(models.Model):
# 
#     HTTP_METHODS = ['GET', 'POST', 'HEAD', 'PUT', 'PATCH', 'DELETE',
#                     'CONNECT', 'OPTIONS', 'TRACE']
# 
#     user = models.ForeignKey(User, blank=True, null=True)
#     user_ip = models.GenericIPAddressField()
#     role = models.ForeignKey(core_models.ProviderType,
#                              blank=True, null=True)
# 
#     method = models.CharField(
#         max_length=max(len(v) for v in HTTP_METHODS),
#         choices=[(v, v) for v in HTTP_METHODS])
# 
#     url = models.URLField(max_length=256)
#     referrer = models.URLField(max_length=256, blank=True, null=True)
# 
#     status_code = models.PositiveSmallIntegerField()
# 
#     timestamp = models.DateTimeField(auto_now_add=True)
# 
#     def __str__(self):
#         return '%s by %s to %s at %s' % (self.method, self.user, self.url,
#                                          self.timestamp)


from builtins import str
from django.test import TestCase, override_settings
from django.test import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from pttrack.models import ProviderType
from pttrack.test_views import build_provider, log_in_provider
from .models import PageviewRecord
from .middleware import AuditMiddleware
from __future__ import unicode_literals



class TestAudit(TestCase):

    fixtures = ['pttrack.json']

    def setUp(self):
        self.client = Client()

    def test_audit_unicode(self):
        """Check that unicode works for TestAudit
        """

# Path: audit/models.py
# class PageviewRecord(models.Model):
# 
#     HTTP_METHODS = ['GET', 'POST', 'HEAD', 'PUT', 'PATCH', 'DELETE',
#                     'CONNECT', 'OPTIONS', 'TRACE']
# 
#     user = models.ForeignKey(User, blank=True, null=True)
#     user_ip = models.GenericIPAddressField()
#     role = models.ForeignKey(core_models.ProviderType,
#                              blank=True, null=True)
# 
#     method = models.CharField(
#         max_length=max(len(v) for v in HTTP_METHODS),
#         choices=[(v, v) for v in HTTP_METHODS])
# 
#     url = models.URLField(max_length=256)
#     referrer = models.URLField(max_length=256, blank=True, null=True)
# 
#     status_code = models.PositiveSmallIntegerField()
# 
#     timestamp = models.DateTimeField(auto_now_add=True)
# 
#     def __str__(self):
#         return '%s by %s to %s at %s' % (self.method, self.user, self.url,
#                                          self.timestamp)


# Path: audit/tests.py
from builtins import str
from django.test import TestCase, override_settings
from django.test import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from pttrack.models import ProviderType
from pttrack.test_views import build_provider, log_in_provider
from .models import PageviewRecord
from .middleware import AuditMiddleware

from __future__ import unicode_literals



class TestAudit(TestCase):

    fixtures = ['pttrack.json']

    def setUp(self):
        self.client = Client()

    def test_audit_unicode(self):
        """Check that unicode works for TestAudit
        """

        p = PageviewRecord.objects.create(