#NEWLINE# def test_siteblock( self ) : #NEWLINE# #INDENT# context = Context ( ) #NEWLINE# context [ 'request' ] = MockRequest ( '/' , user_authorized = False ) #NEWLINE# result = Template ( '{% load siteblocks %}{% siteblock "myblock" %}' ) . render ( context ) #NEWLINE# self . assertEqual ( result , '' ) #NEWLINE# b1 = Block ( alias = 'myblock' , url = '*' , contents = 'my_block_here' ) #NEWLINE# b1 . save ( force_insert = True ) #NEWLINE# result = Template ( '{% load siteblocks %}{% siteblock "myblock" %}' ) . render ( context ) #NEWLINE# self . assertEqual ( result , 'my_block_here' ) #NEWLINE# Template ( '{% load siteblocks %}{% siteblock "myblock" as somevar %}' ) . render ( context ) #NEWLINE# self . assertEqual ( context . get ( 'somevar' ) , 'my_block_here' )