mirror of
https://github.com/django/django.git
synced 2025-07-06 18:59:13 +00:00
[gsoc2009-testing] Confirming that test-only models have a table in the db
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/test-improvements@11143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f2be59849c
commit
0c11738415
@ -199,6 +199,7 @@ class AppCache(object):
|
|||||||
|
|
||||||
def remove_model(self, model_name):
|
def remove_model(self, model_name):
|
||||||
"""Removes a model from the cache. Used when loading test-only models."""
|
"""Removes a model from the cache. Used when loading test-only models."""
|
||||||
|
try:
|
||||||
try:
|
try:
|
||||||
self.write_lock.acquire()
|
self.write_lock.acquire()
|
||||||
if model_name in self.app_models:
|
if model_name in self.app_models:
|
||||||
|
@ -74,6 +74,14 @@ class AdminViewBasicTest(TestCase):
|
|||||||
"Couldn't find an input with the right value in the response."
|
"Couldn't find an input with the right value in the response."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def testAddWithGETArgsTestModel(self):
|
||||||
|
response = self.client.get('/test_admin/%s/admin_views/sectiontest/add/' % self.urlbit, {'name': 'My TestSection'})
|
||||||
|
self.failUnlessEqual(response.status_code, 200)
|
||||||
|
self.failUnless(
|
||||||
|
'value="My TestSection"' in response.content,
|
||||||
|
"Couldn't find an input with the right value in the response."
|
||||||
|
)
|
||||||
|
|
||||||
def testBasicEditGet(self):
|
def testBasicEditGet(self):
|
||||||
"""
|
"""
|
||||||
A smoke test to ensureGET on the change_view works.
|
A smoke test to ensureGET on the change_view works.
|
||||||
@ -300,6 +308,10 @@ class CustomModelAdminTest(AdminViewBasicTest):
|
|||||||
"""
|
"""
|
||||||
response = self.client.get('/test_admin/%s/admin_views/section/add/' % self.urlbit)
|
response = self.client.get('/test_admin/%s/admin_views/section/add/' % self.urlbit)
|
||||||
self.failUnlessEqual(response.status_code, 200)
|
self.failUnlessEqual(response.status_code, 200)
|
||||||
|
def testAddWithGETArgsTestModel(self):
|
||||||
|
response = self.client.get('/test_admin/%s/admin_views/sectiontest/add/' % self.urlbit, {'name': 'My TestSection'})
|
||||||
|
self.failUnlessEqual(response.status_code, 404)
|
||||||
|
|
||||||
|
|
||||||
def get_perm(Model, perm):
|
def get_perm(Model, perm):
|
||||||
"""Return the permission object, for the Model"""
|
"""Return the permission object, for the Model"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user