mirror of https://github.com/django/django.git
Removed a ton of unused local vars
This commit is contained in:
parent
0ee8aa5c39
commit
96fd5557f9
|
@ -23,14 +23,14 @@ def remote_user_auth_view(request):
|
|||
return HttpResponse(t.render(c))
|
||||
|
||||
def auth_processor_no_attr_access(request):
|
||||
r1 = render_to_response('context_processors/auth_attrs_no_access.html',
|
||||
render_to_response('context_processors/auth_attrs_no_access.html',
|
||||
RequestContext(request, {}, processors=[context_processors.auth]))
|
||||
# *After* rendering, we check whether the session was accessed
|
||||
return render_to_response('context_processors/auth_attrs_test_access.html',
|
||||
{'session_accessed':request.session.accessed})
|
||||
|
||||
def auth_processor_attr_access(request):
|
||||
r1 = render_to_response('context_processors/auth_attrs_access.html',
|
||||
render_to_response('context_processors/auth_attrs_access.html',
|
||||
RequestContext(request, {}, processors=[context_processors.auth]))
|
||||
return render_to_response('context_processors/auth_attrs_test_access.html',
|
||||
{'session_accessed':request.session.accessed})
|
||||
|
|
|
@ -74,7 +74,6 @@ class SpatiaLiteCreation(DatabaseCreation):
|
|||
|
||||
if isinstance(f, GeometryField):
|
||||
gqn = self.connection.ops.geo_quote_name
|
||||
qn = self.connection.ops.quote_name
|
||||
db_table = model._meta.db_table
|
||||
|
||||
output.append(style.SQL_KEYWORD('SELECT ') +
|
||||
|
|
|
@ -469,7 +469,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
|
|||
|
||||
def test_multipolygons(self):
|
||||
"Testing MultiPolygon objects."
|
||||
prev = fromstr('POINT (0 0)')
|
||||
fromstr('POINT (0 0)')
|
||||
for mp in self.geometries.multipolygons:
|
||||
mpoly = fromstr(mp.wkt)
|
||||
self.assertEqual(mpoly.geom_type, 'MultiPolygon')
|
||||
|
@ -709,7 +709,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
|
|||
new = Point(random.randint(21, 100), random.randint(21, 100))
|
||||
# Testing the assignment
|
||||
mp[i] = new
|
||||
s = str(new) # what was used for the assignment is still accessible
|
||||
str(new) # what was used for the assignment is still accessible
|
||||
self.assertEqual(mp[i], new)
|
||||
self.assertEqual(mp[i].wkt, new.wkt)
|
||||
self.assertNotEqual(pnt, mp[i])
|
||||
|
@ -730,7 +730,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
|
|||
self.assertNotEqual(mpoly[i], poly)
|
||||
# Testing the assignment
|
||||
mpoly[i] = poly
|
||||
s = str(poly) # Still accessible
|
||||
str(poly) # Still accessible
|
||||
self.assertEqual(mpoly[i], poly)
|
||||
self.assertNotEqual(mpoly[i], old_poly)
|
||||
|
||||
|
|
|
@ -93,8 +93,8 @@ class Command(LabelCommand):
|
|||
show_mapping = options.pop('mapping', False)
|
||||
|
||||
# Getting rid of settings that `_ogrinspect` doesn't like.
|
||||
verbosity = options.pop('verbosity', False)
|
||||
settings = options.pop('settings', False)
|
||||
options.pop('verbosity', False)
|
||||
options.pop('settings', False)
|
||||
|
||||
# Returning the output of ogrinspect with the given arguments
|
||||
# and options.
|
||||
|
|
|
@ -37,7 +37,7 @@ class GeoRegressionTests(TestCase):
|
|||
'description' : name,
|
||||
'kml' : '<Point><coordinates>5.0,23.0</coordinates></Point>'
|
||||
}]
|
||||
kmz = render_to_kmz('gis/kml/placemarks.kml', {'places' : places})
|
||||
render_to_kmz('gis/kml/placemarks.kml', {'places' : places})
|
||||
|
||||
@no_spatialite
|
||||
@no_mysql
|
||||
|
@ -52,8 +52,8 @@ class GeoRegressionTests(TestCase):
|
|||
def test_unicode_date(self):
|
||||
"Testing dates are converted properly, even on SpatiaLite. See #16408."
|
||||
founded = datetime(1857, 5, 23)
|
||||
mansfield = PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)',
|
||||
founded=founded)
|
||||
PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)',
|
||||
founded=founded)
|
||||
self.assertEqual(founded, PennsylvaniaCity.objects.datetimes('founded', 'day')[0])
|
||||
self.assertEqual(founded, PennsylvaniaCity.objects.aggregate(Min('founded'))['founded__min'])
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ class GeoModelTest(TestCase):
|
|||
def test_inherited_geofields(self):
|
||||
"Test GeoQuerySet methods on inherited Geometry fields."
|
||||
# Creating a Pennsylvanian city.
|
||||
mansfield = PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)')
|
||||
PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)')
|
||||
|
||||
# All transformation SQL will need to be performed on the
|
||||
# _parent_ table.
|
||||
|
@ -410,7 +410,6 @@ class GeoQuerySetTest(TestCase):
|
|||
def test_diff_intersection_union(self):
|
||||
"Testing the `difference`, `intersection`, `sym_difference`, and `union` GeoQuerySet methods."
|
||||
geom = Point(5, 23)
|
||||
tol = 1
|
||||
qs = Country.objects.all().difference(geom).sym_difference(geom).union(geom)
|
||||
|
||||
# XXX For some reason SpatiaLite does something screwey with the Texas geometry here. Also,
|
||||
|
@ -692,7 +691,7 @@ class GeoQuerySetTest(TestCase):
|
|||
'12.46472 43.89555,12.45917 43.89611,12.41639 43.90472,'
|
||||
'12.41222 43.90610,12.40782 43.91366,12.40389 43.92667,'
|
||||
'12.40500 43.94833,12.40889 43.95499,12.41580 43.95795)))')
|
||||
sm = Country.objects.create(name='San Marino', mpoly=fromstr(wkt))
|
||||
Country.objects.create(name='San Marino', mpoly=fromstr(wkt))
|
||||
|
||||
# Because floating-point arithmetic isn't exact, we set a tolerance
|
||||
# to pass into GEOS `equals_exact`.
|
||||
|
|
|
@ -42,7 +42,7 @@ class GeographyTest(TestCase):
|
|||
"Testing GeoQuerySet.distance() support on non-point geography fields."
|
||||
# `GeoQuerySet.distance` is not allowed geometry fields.
|
||||
htown = City.objects.get(name='Houston')
|
||||
qs = Zipcode.objects.distance(htown.point)
|
||||
Zipcode.objects.distance(htown.point)
|
||||
|
||||
def test04_invalid_operators_functions(self):
|
||||
"Ensuring exceptions are raised for operators & functions invalid on geography fields."
|
||||
|
|
|
@ -58,11 +58,11 @@ class LayerMapTest(TestCase):
|
|||
# ensuring that a LayerMapError is raised.
|
||||
for bad_map in (bad1, bad2, bad3):
|
||||
with self.assertRaises(LayerMapError):
|
||||
lm = LayerMapping(City, city_shp, bad_map)
|
||||
LayerMapping(City, city_shp, bad_map)
|
||||
|
||||
# A LookupError should be thrown for bogus encodings.
|
||||
with self.assertRaises(LookupError):
|
||||
lm = LayerMapping(City, city_shp, city_mapping, encoding='foobar')
|
||||
LayerMapping(City, city_shp, city_mapping, encoding='foobar')
|
||||
|
||||
def test_simple_layermap(self):
|
||||
"Test LayerMapping import of a simple point shapefile."
|
||||
|
|
|
@ -119,7 +119,7 @@ class RelatedGeoModelTest(TestCase):
|
|||
def test05_select_related_fk_to_subclass(self):
|
||||
"Testing that calling select_related on a query over a model with an FK to a model subclass works"
|
||||
# Regression test for #9752.
|
||||
l = list(DirectoryEntry.objects.all().select_related())
|
||||
list(DirectoryEntry.objects.all().select_related())
|
||||
|
||||
def test06_f_expressions(self):
|
||||
"Testing F() expressions on GeometryFields."
|
||||
|
@ -134,7 +134,7 @@ class RelatedGeoModelTest(TestCase):
|
|||
c1 = pcity.location.point
|
||||
c2 = c1.transform(2276, clone=True)
|
||||
b2 = c2.buffer(100)
|
||||
p1 = Parcel.objects.create(name='P1', city=pcity, center1=c1, center2=c2, border1=b1, border2=b2)
|
||||
Parcel.objects.create(name='P1', city=pcity, center1=c1, center2=c2, border1=b1, border2=b2)
|
||||
|
||||
# Now creating a second Parcel where the borders are the same, just
|
||||
# in different coordinate systems. The center points are also the
|
||||
|
@ -142,7 +142,7 @@ class RelatedGeoModelTest(TestCase):
|
|||
# actually correspond to the centroid of the border.
|
||||
c1 = b1.centroid
|
||||
c2 = c1.transform(2276, clone=True)
|
||||
p2 = Parcel.objects.create(name='P2', city=pcity, center1=c1, center2=c2, border1=b1, border2=b1)
|
||||
Parcel.objects.create(name='P2', city=pcity, center1=c1, center2=c2, border1=b1, border2=b1)
|
||||
|
||||
# Should return the second Parcel, which has the center within the
|
||||
# border.
|
||||
|
@ -263,7 +263,7 @@ class RelatedGeoModelTest(TestCase):
|
|||
@no_oracle
|
||||
def test13_select_related_null_fk(self):
|
||||
"Testing `select_related` on a nullable ForeignKey via `GeoManager`. See #11381."
|
||||
no_author = Book.objects.create(title='Without Author')
|
||||
Book.objects.create(title='Without Author')
|
||||
b = Book.objects.select_related('author').get(title='Without Author')
|
||||
# Should be `None`, and not a 'dummy' model.
|
||||
self.assertEqual(None, b.author)
|
||||
|
@ -294,7 +294,7 @@ class RelatedGeoModelTest(TestCase):
|
|||
# This triggers TypeError when `get_default_columns` has no `local_only`
|
||||
# keyword. The TypeError is swallowed if QuerySet is actually
|
||||
# evaluated as list generation swallows TypeError in CPython.
|
||||
sql = str(qs.query)
|
||||
str(qs.query)
|
||||
|
||||
def test16_annotated_date_queryset(self):
|
||||
"Ensure annotated date querysets work if spatial backend is used. See #14648."
|
||||
|
|
|
@ -64,20 +64,16 @@ class DistanceTest(unittest.TestCase):
|
|||
self.assertEqual(d4.m, -200)
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
d5 = d1 + 1
|
||||
self.fail('Distance + number should raise TypeError')
|
||||
d1 + 1
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
d5 = d1 - 1
|
||||
self.fail('Distance - number should raise TypeError')
|
||||
d1 - 1
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
d1 += 1
|
||||
self.fail('Distance += number should raise TypeError')
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
d1 -= 1
|
||||
self.fail('Distance -= number should raise TypeError')
|
||||
|
||||
def testMultiplication(self):
|
||||
"Test multiplication & division"
|
||||
|
@ -103,11 +99,9 @@ class DistanceTest(unittest.TestCase):
|
|||
|
||||
with self.assertRaises(TypeError):
|
||||
d1 *= D(m=1)
|
||||
self.fail('Distance *= Distance should raise TypeError')
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
d1 /= D(m=1)
|
||||
self.fail('Distance /= Distance should raise TypeError')
|
||||
|
||||
def testUnitConversions(self):
|
||||
"Testing default units during maths"
|
||||
|
@ -196,20 +190,16 @@ class AreaTest(unittest.TestCase):
|
|||
self.assertEqual(a4.sq_m, -200)
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
a5 = a1 + 1
|
||||
self.fail('Area + number should raise TypeError')
|
||||
a1 + 1
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
a5 = a1 - 1
|
||||
self.fail('Area - number should raise TypeError')
|
||||
a1 - 1
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
a1 += 1
|
||||
self.fail('Area += number should raise TypeError')
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
a1 -= 1
|
||||
self.fail('Area -= number should raise TypeError')
|
||||
|
||||
def testMultiplication(self):
|
||||
"Test multiplication & division"
|
||||
|
@ -228,20 +218,16 @@ class AreaTest(unittest.TestCase):
|
|||
self.assertEqual(a4.sq_m, 10)
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
a5 = a1 * A(sq_m=1)
|
||||
self.fail('Area * Area should raise TypeError')
|
||||
a1 * A(sq_m=1)
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
a1 *= A(sq_m=1)
|
||||
self.fail('Area *= Area should raise TypeError')
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
a5 = a1 / A(sq_m=1)
|
||||
self.fail('Area / Area should raise TypeError')
|
||||
a1 / A(sq_m=1)
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
a1 /= A(sq_m=1)
|
||||
self.fail('Area /= Area should raise TypeError')
|
||||
|
||||
def testUnitConversions(self):
|
||||
"Testing default units during maths"
|
||||
|
|
|
@ -92,8 +92,6 @@ class SpatialRefSysTest(unittest.TestCase):
|
|||
ellps2 = srs.ellipsoid
|
||||
|
||||
for i in range(3):
|
||||
param1 = ellps1[i]
|
||||
param2 = ellps2[i]
|
||||
self.assertAlmostEqual(ellps1[i], ellps2[i], prec[i])
|
||||
|
||||
def suite():
|
||||
|
|
|
@ -216,7 +216,7 @@ class LayerMapping(object):
|
|||
for rel_name, ogr_field in ogr_name.items():
|
||||
idx = check_ogr_fld(ogr_field)
|
||||
try:
|
||||
rel_field = rel_model._meta.get_field(rel_name)
|
||||
rel_model._meta.get_field(rel_name)
|
||||
except models.fields.FieldDoesNotExist:
|
||||
raise LayerMapError('ForeignKey mapping field "%s" not in %s fields.' %
|
||||
(rel_name, rel_model.__class__.__name__))
|
||||
|
|
|
@ -72,9 +72,9 @@ def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
|
|||
try:
|
||||
# Try getting via SRID only, because using all kwargs may
|
||||
# differ from exact wkt/proj in database.
|
||||
sr = SpatialRefSys.objects.using(database).get(srid=srs.srid)
|
||||
SpatialRefSys.objects.using(database).get(srid=srs.srid)
|
||||
except SpatialRefSys.DoesNotExist:
|
||||
sr = SpatialRefSys.objects.using(database).create(**kwargs)
|
||||
SpatialRefSys.objects.using(database).create(**kwargs)
|
||||
|
||||
# Alias is for backwards-compatibility purposes.
|
||||
add_postgis_srs = add_srs_entry
|
||||
|
|
|
@ -230,7 +230,7 @@ class BaseTests(object):
|
|||
data = {
|
||||
'messages': ['Test message %d' % x for x in range(5)],
|
||||
}
|
||||
show_url = reverse('django.contrib.messages.tests.urls.show')
|
||||
reverse('django.contrib.messages.tests.urls.show')
|
||||
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
||||
add_url = reverse('django.contrib.messages.tests.urls.add',
|
||||
args=(level,))
|
||||
|
|
|
@ -160,7 +160,7 @@ class ChangeListTests(TestCase):
|
|||
|
||||
new_parent = Parent.objects.create(name='parent')
|
||||
for i in range(200):
|
||||
new_child = Child.objects.create(name='name %s' % i, parent=new_parent)
|
||||
Child.objects.create(name='name %s' % i, parent=new_parent)
|
||||
request = self.factory.get('/child/', data={'p': -1}) # Anything outside range
|
||||
m = ChildAdmin(Child, admin.site)
|
||||
|
||||
|
@ -176,7 +176,7 @@ class ChangeListTests(TestCase):
|
|||
def test_custom_paginator(self):
|
||||
new_parent = Parent.objects.create(name='parent')
|
||||
for i in range(200):
|
||||
new_child = Child.objects.create(name='name %s' % i, parent=new_parent)
|
||||
Child.objects.create(name='name %s' % i, parent=new_parent)
|
||||
|
||||
request = self.factory.get('/child/')
|
||||
m = CustomPaginationAdmin(Child, admin.site)
|
||||
|
|
|
@ -8,11 +8,11 @@ from django.test import TestCase
|
|||
from django.test.utils import override_settings
|
||||
|
||||
# local test models
|
||||
from .admin import InnerInline, TitleInline, site
|
||||
from .admin import InnerInline
|
||||
from .models import (Holder, Inner, Holder2, Inner2, Holder3, Inner3, Person,
|
||||
OutfitItem, Fashionista, Teacher, Parent, Child, Author, Book, Profile,
|
||||
ProfileCollection, ParentModelWithCustomPk, ChildModel1, ChildModel2,
|
||||
Sighting, Title, Novel, Chapter, FootNote, BinaryTree)
|
||||
Sighting, Novel, Chapter, FootNote, BinaryTree)
|
||||
|
||||
|
||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
||||
|
@ -45,7 +45,7 @@ class TestInline(TestCase):
|
|||
def test_readonly_stacked_inline_label(self):
|
||||
"""Bug #13174."""
|
||||
holder = Holder.objects.create(dummy=42)
|
||||
inner = Inner.objects.create(holder=holder, dummy=42, readonly='')
|
||||
Inner.objects.create(holder=holder, dummy=42, readonly='')
|
||||
response = self.client.get('/admin/admin_inlines/holder/%i/'
|
||||
% holder.id)
|
||||
self.assertContains(response, '<label>Inner readonly label:</label>')
|
||||
|
@ -195,7 +195,7 @@ class TestInline(TestCase):
|
|||
|
||||
def test_custom_get_extra_form(self):
|
||||
bt_head = BinaryTree.objects.create(name="Tree Head")
|
||||
bt_child = BinaryTree.objects.create(name="First Child", parent=bt_head)
|
||||
BinaryTree.objects.create(name="First Child", parent=bt_head)
|
||||
|
||||
# The maximum number of forms should respect 'get_max_num' on the
|
||||
# ModelAdmin
|
||||
|
@ -575,7 +575,6 @@ class SeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
|||
Ensure that the "Add another XXX" link correctly adds items to the
|
||||
inline form.
|
||||
"""
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
self.admin_login(username='super', password='secret')
|
||||
self.selenium.get('%s%s' % (self.live_server_url,
|
||||
'/admin/admin_inlines/profilecollection/add/'))
|
||||
|
|
|
@ -106,7 +106,6 @@ class AdminScriptTestCase(unittest.TestCase):
|
|||
return paths
|
||||
|
||||
def run_test(self, script, args, settings_file=None, apps=None):
|
||||
project_dir = test_dir
|
||||
base_dir = os.path.dirname(test_dir)
|
||||
# The base dir for Django's tests is one level up.
|
||||
tests_dir = os.path.dirname(os.path.dirname(__file__))
|
||||
|
|
|
@ -377,9 +377,9 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
|
|||
(AdminOrderedAdminMethod, 'adminorderedadminmethod'),
|
||||
(AdminOrderedCallable, 'adminorderedcallable')]
|
||||
for model, url in models:
|
||||
a1 = model.objects.create(stuff='The Last Item', order=3)
|
||||
a2 = model.objects.create(stuff='The First Item', order=1)
|
||||
a3 = model.objects.create(stuff='The Middle Item', order=2)
|
||||
model.objects.create(stuff='The Last Item', order=3)
|
||||
model.objects.create(stuff='The First Item', order=1)
|
||||
model.objects.create(stuff='The Middle Item', order=2)
|
||||
response = self.client.get('/test_admin/admin/admin_views/%s/' % url, {})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
# Should have 3 columns including action checkbox col.
|
||||
|
@ -596,7 +596,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
|
|||
(against 9bea85795705d015cdadc82c68b99196a8554f5c)
|
||||
"""
|
||||
user = User.objects.get(username='super')
|
||||
password = user.password
|
||||
user.set_unusable_password()
|
||||
user.save()
|
||||
|
||||
|
@ -734,7 +733,7 @@ class SaveAsTests(TestCase):
|
|||
def test_save_as_duplication(self):
|
||||
"""Ensure save as actually creates a new person"""
|
||||
post_data = {'_saveasnew': '', 'name': 'John M', 'gender': 1, 'age': 42}
|
||||
response = self.client.post('/test_admin/admin/admin_views/person/1/', post_data)
|
||||
self.client.post('/test_admin/admin/admin_views/person/1/', post_data)
|
||||
self.assertEqual(len(Person.objects.filter(name='John M')), 1)
|
||||
self.assertEqual(len(Person.objects.filter(id=1)), 1)
|
||||
|
||||
|
@ -1065,7 +1064,7 @@ class AdminViewPermissionsTest(TestCase):
|
|||
|
||||
# 8509 - if a normal user is already logged in, it is possible
|
||||
# to change user into the superuser without error
|
||||
login = self.client.login(username='joepublic', password='secret')
|
||||
self.client.login(username='joepublic', password='secret')
|
||||
# Check and make sure that if user expires, data still persists
|
||||
self.client.get('/test_admin/admin/')
|
||||
self.client.post('/test_admin/admin/', self.super_login)
|
||||
|
@ -1442,7 +1441,7 @@ class AdminViewDeletedObjectsTest(TestCase):
|
|||
|
||||
"""
|
||||
plot = Plot.objects.get(pk=3)
|
||||
tag = FunkyTag.objects.create(content_object=plot, name='hott')
|
||||
FunkyTag.objects.create(content_object=plot, name='hott')
|
||||
should_contain = """<li>Funky tag: hott"""
|
||||
response = self.client.get('/test_admin/admin/admin_views/plot/%s/delete/' % quote(3))
|
||||
self.assertContains(response, should_contain)
|
||||
|
@ -2222,8 +2221,8 @@ class AdminSearchTest(TestCase):
|
|||
self.assertNotContains(response, "Guido")
|
||||
|
||||
def test_pluggable_search(self):
|
||||
p1 = PluggableSearchPerson.objects.create(name="Bob", age=10)
|
||||
p2 = PluggableSearchPerson.objects.create(name="Amy", age=20)
|
||||
PluggableSearchPerson.objects.create(name="Bob", age=10)
|
||||
PluggableSearchPerson.objects.create(name="Amy", age=20)
|
||||
|
||||
response = self.client.get('/test_admin/admin/admin_views/pluggablesearchperson/?q=Bob')
|
||||
# confirm the search returned one object
|
||||
|
@ -2342,7 +2341,7 @@ class AdminActionsTest(TestCase):
|
|||
'action': 'mail_admin',
|
||||
'index': 0,
|
||||
}
|
||||
response = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
||||
self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
self.assertEqual(mail.outbox[0].subject, 'Greetings from a ModelAdmin action')
|
||||
|
||||
|
@ -2362,7 +2361,7 @@ class AdminActionsTest(TestCase):
|
|||
self.assertIsInstance(confirmation, TemplateResponse)
|
||||
self.assertContains(confirmation, "Are you sure you want to delete the selected subscribers?")
|
||||
self.assertContains(confirmation, ACTION_CHECKBOX_NAME, count=2)
|
||||
response = self.client.post('/test_admin/admin/admin_views/subscriber/', delete_confirmation_data)
|
||||
self.client.post('/test_admin/admin/admin_views/subscriber/', delete_confirmation_data)
|
||||
self.assertEqual(Subscriber.objects.count(), 0)
|
||||
|
||||
def test_non_localized_pk(self):
|
||||
|
@ -2538,7 +2537,7 @@ action)</option>
|
|||
# ...but we clicked "go" on the top form.
|
||||
'index': 0
|
||||
}
|
||||
response = self.client.post('/test_admin/admin/admin_views/externalsubscriber/', action_data)
|
||||
self.client.post('/test_admin/admin/admin_views/externalsubscriber/', action_data)
|
||||
|
||||
# Send mail, don't delete.
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
|
|
Loading…
Reference in New Issue