Merge branch 'master' of github.com:pydanny/django-admin2

This commit is contained in:
Daniel Greenfeld 2013-05-18 13:31:02 +02:00
commit 7ca17936f1
3 changed files with 38 additions and 13 deletions

5
example/blog/admin.py Normal file
View file

@ -0,0 +1,5 @@
from django.contrib import admin
from .models import Post, Comment
admin.site.register(Post)
admin.site.register(Comment)

View file

@ -1,16 +1,36 @@
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
from django.utils import unittest
from django.test.client import RequestFactory
Replace this with more appropriate tests for your application.
"""
from djadmin2 import views
from django.test import TestCase
class ViewTest(unittest.TestCase):
def setUp(self):
self.factory = RequestFactory()
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)
class IndexViewTest(ViewTest):
def test_response_ok(self):
request = self.factory.get('/admin/blog/post/')
response = views.IndexView.as_view()(request)
self.assertEqual(response.status_code, 200)
class ModelListViewTest(ViewTest):
pass
class ModelDetailViewTest(ViewTest):
pass
class ModelEditFormViewTest(ViewTest):
pass
class ModelAddFormViewTest(ViewTest):
pass
class ModelDeleteViewTest(ViewTest):
pass

View file

@ -5,7 +5,7 @@ admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^admin2/$', include('djadmin2.urls')),
url(r'^admin2/', include('djadmin2.urls')),
# url(r'^example/', include('example.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation: