Skip to content

Commit

Permalink
updated some tests to avoid patching the request object. (#5474)
Browse files Browse the repository at this point in the history
  • Loading branch information
czpython committed Jun 30, 2016
1 parent a7994a9 commit e6e7177
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cms/tests/test_placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,11 +1049,6 @@ class PlaceholderAdminTest(PlaceholderAdminTestBase):
def test_global_limit(self):
placeholder = self.get_placeholder()
admin_instance = self.get_admin()
get_data = {
'plugin_type': 'LinkPlugin',
'placeholder_id': placeholder.pk,
'plugin_language': 'en',
}
post_data = {
'name': 'test',
'url': 'http://www.example.org/'
Expand All @@ -1062,7 +1057,12 @@ def test_global_limit(self):
with UserLoginContext(self, superuser):
with override_settings(CMS_PLACEHOLDER_CONF=self.placeholderconf):
request = self.get_post_request(post_data)
request.GET = get_data
request.GET = request.GET.copy()
request.GET.update({
'plugin_type': 'LinkPlugin',
'placeholder_id': placeholder.pk,
'plugin_language': 'en',
})
response = admin_instance.add_plugin(request) # first
self.assertEqual(response.status_code, 200)
response = admin_instance.add_plugin(request) # second
Expand All @@ -1077,18 +1077,18 @@ def test_global_limit(self):
def test_type_limit(self):
placeholder = self.get_placeholder()
admin_instance = self.get_admin()
data = {
'plugin_type': 'TextPlugin',
'placeholder_id': placeholder.pk,
'plugin_language': 'en',
}
superuser = self.get_superuser()
with UserLoginContext(self, superuser):
with self.settings(CMS_PLACEHOLDER_CONF=self.placeholderconf):
request = self.get_post_request({
'body': 'test'
})
request.GET = data
request.GET = request.GET.copy()
request.GET.update({
'plugin_type': 'TextPlugin',
'placeholder_id': placeholder.pk,
'plugin_language': 'en',
})
response = admin_instance.add_plugin(request) # first
# Note: TextPlugin returns 302 instead of 200 on successful
# add_view call.
Expand Down

0 comments on commit e6e7177

Please sign in to comment.