Skip to content

Commit

Permalink
I've written some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
valyagolev committed Jun 23, 2011
1 parent 6b504bc commit dc97ae8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 0 deletions.
Empty file added requestlogger/models.py
Empty file.
1 change: 1 addition & 0 deletions requestlogger/tests.py
@@ -0,0 +1 @@

Empty file added testproject/rltests/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions testproject/rltests/models.py
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
24 changes: 24 additions & 0 deletions testproject/rltests/tests.py
@@ -0,0 +1,24 @@
from django.test import TestCase

from requestlogger.models import Request

class RequestLoggerTestCase(TestCase):
def setUp(self):
Request.objects.all().delete()

def tearDown(self):
Request.objects.all().delete()

def testItActuallyLogsRequests(self):
self.client.get('/admin/')

requests = Request.objects.all()
self.assertEquals(len(requests), 1)

req = requests[0]
self.assertEquals(req.method, 'GET')
self.assertEquals(req.path, '/admin/')
self.assertNotEquals(req.time, 0)



1 change: 1 addition & 0 deletions testproject/rltests/views.py
@@ -0,0 +1 @@
# Create your views here.
1 change: 1 addition & 0 deletions testproject/settings.py
Expand Up @@ -122,6 +122,7 @@

'requestlogger',
'south',
'rltests',
)

# A sample logging configuration. The only tangible logging
Expand Down

0 comments on commit dc97ae8

Please sign in to comment.