<s> from __future__ import unicode_literals <EOL> import json <EOL> from django . conf import settings <EOL> from django . contrib import admin <EOL> from django . test . utils import override_settings <EOL> from cms . models import Page <EOL> from cms . utils . compat . dj import is_installed <EOL> from cms . test_utils . testcases import CMSTestCase , URL_CMS_PAGE_ADD , URL_CMS_PLUGIN_ADD <EOL> APPS_WITHOUT_REVERSION = [ app for app in settings . INSTALLED_APPS if app != '<STR_LIT>' ] <EOL> class ContainerPluginTest ( CMSTestCase ) : <EOL> def setUp ( self ) : <EOL> self . admin_site = admin . sites . AdminSite ( ) <EOL> self . user = self . get_superuser ( ) <EOL> self . password = "<STR_LIT>" <EOL> self . user . set_password ( self . password ) <EOL> self . user . save ( ) <EOL> self . client . login ( username = self . user . username , password = self . password ) <EOL> self . language = '<STR_LIT>' <EOL> self . site_id = settings . SITE_ID <EOL> response = self . client . post ( <EOL> '<STR_LIT:/>' + self . language + URL_CMS_PAGE_ADD [ <NUM_LIT:3> : ] , <EOL> data = { <EOL> '<STR_LIT>' : self . language , <EOL> '<STR_LIT>' : self . site_id , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:title>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> follow = True , <EOL> ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . page = Page . objects . get ( publisher_is_draft = True , is_home = True ) <EOL> self . placeholder = self . page . placeholders . get ( slot = '<STR_LIT>' ) <EOL> def _create_and_configure_a_container_plugin ( self ) : <EOL> response = self . client . post ( <EOL> '<STR_LIT:/>' + self . language + URL_CMS_PLUGIN_ADD [ <NUM_LIT:3> : ] , <EOL> data = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : self . language , <EOL> '<STR_LIT>' : self . placeholder . id , <EOL> } , <EOL> HTTP_X_REQUESTED_WITH = '<STR_LIT>' , <EOL> ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> response_data = json . loads ( response . content . decode ( '<STR_LIT:utf-8>' ) ) <EOL> plugin_url = response_data [ '<STR_LIT:url>' ] <EOL> response = self . client . post ( <EOL> plugin_url , <EOL> data = { <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> @ override_settings ( INSTALLED_APPS = APPS_WITHOUT_REVERSION ) <EOL> def test_without_reversion ( self ) : <EOL> self . assertFalse ( is_installed ( '<STR_LIT>' ) ) <EOL> self . _create_and_configure_a_container_plugin ( ) <EOL> def test_with_reversion ( self ) : <EOL> self . assertTrue ( is_installed ( '<STR_LIT>' ) ) <EOL> self . _create_and_configure_a_container_plugin ( ) </s>
