#NEWLINE# def test_add_plugin_alias( self ) : #NEWLINE# #INDENT# page_en = api . create_page ( 'PluginOrderPage' , 'col_two.html' , 'en' , slug = 'page1' , published = True , in_navigation = True ) #NEWLINE# ph_en = page_en . placeholders . get ( slot = 'col_left' ) #NEWLINE# text_plugin_1 = api . add_plugin ( ph_en , 'TextPlugin' , 'en' , body = "I'm the first" ) #NEWLINE# with self . login_user_context ( self . get_superuser ( ) ) : #NEWLINE# #INDENT# response = self . client . post ( admin_reverse ( 'cms_create_alias' ) , data = { #NEWLINE# #INDENT# 'plugin_id' : text_plugin_1 . pk , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# response = self . client . post ( admin_reverse ( 'cms_create_alias' ) , data = { #NEWLINE# #INDENT# 'placeholder_id' : ph_en . pk , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# response = self . client . post ( admin_reverse ( 'cms_create_alias' ) ) #NEWLINE# self . assertEqual ( response . status_code , 400 ) #NEWLINE# response = self . client . post ( admin_reverse ( 'cms_create_alias' ) , data = { #NEWLINE# #INDENT# 'plugin_id' : 20000 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response . status_code , 400 ) #NEWLINE# response = self . client . post ( admin_reverse ( 'cms_create_alias' ) , data = { #NEWLINE# #INDENT# 'placeholder_id' : 20000 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response . status_code , 400 ) #NEWLINE# #UNINDENT# response = self . client . post ( admin_reverse ( 'cms_create_alias' ) , data = { #NEWLINE# #INDENT# 'plugin_id' : text_plugin_1 . pk , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response . status_code , 403 ) #NEWLINE# instance = AliasPluginModel . objects . all ( ) [ 0 ] #NEWLINE# admin = AliasPlugin ( ) #NEWLINE# request = self . get_request ( '/' ) #NEWLINE# context = Context ( { #NEWLINE# #INDENT# 'request' : request , #NEWLINE# #UNINDENT# } ) #NEWLINE# admin . render ( context , instance , ph_en ) #NEWLINE# self . assertEqual ( context [ 'content' ] , "I'm the first" )