'Test editing a *PAGE* plugin'

def test_edit(self):

    (page, placeholder, superuser, staff) = self.get_data()
    plugin = add_plugin(placeholder, 'TextPlugin', 'en', body='body')
    plugin_data = {'plugin_id': plugin.pk, 'body': 'newbody'}
    self.assertEqual(plugin.body, 'body')
    self.client.logout()
    endpoint = self.get_change_plugin_uri(plugin)
    response = self.client.post(endpoint, plugin_data)
    self.assertEqual(response.status_code, 302)
    querystring = QueryDict('', mutable=True)
    querystring['next'] = endpoint
    expected_url = '/{lang}/admin/login/?{next}'.format(lang=settings.LANGUAGES[0][0], next=querystring.urlencode(safe='/'))
    self.assertRedirects(response, expected_url)
    plugin = self.reload(plugin)
    self.assertEqual(plugin.body, 'body')
    self.client.login(username=getattr(staff, get_user_model().USERNAME_FIELD), password=getattr(staff, get_user_model().USERNAME_FIELD))
    response = self.client.post(endpoint, plugin_data)
    self.assertEqual(response.status_code, 403)
    plugin = self.reload(plugin)
    self.assertEqual(plugin.body, 'body')
