<s> import os <EOL> from django . conf import settings <EOL> from django . contrib . auth . models import User <EOL> from django . contrib . auth . tests . utils import skipIfCustomUser <EOL> from django . contrib . flatpages . models import FlatPage <EOL> from django . test import TestCase <EOL> from django . test . utils import override_settings <EOL> @ override_settings ( <EOL> LOGIN_URL = '<STR_LIT>' , <EOL> MIDDLEWARE_CLASSES = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) , <EOL> TEMPLATE_DIRS = ( <EOL> os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) , <EOL> ) , <EOL> SITE_ID = <NUM_LIT:1> , <EOL> ) <EOL> class FlatpageViewTests ( TestCase ) : <EOL> fixtures = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> urls = '<STR_LIT>' <EOL> def test_view_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertContains ( response , "<STR_LIT>" ) <EOL> def test_view_non_existent_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> @ skipIfCustomUser <EOL> def test_view_authenticated_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertRedirects ( response , '<STR_LIT>' ) <EOL> User . objects . create_user ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . client . login ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertContains ( response , "<STR_LIT>" ) <EOL> def test_fallback_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> def test_fallback_non_existent_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> def test_view_flatpage_special_chars ( self ) : <EOL> "<STR_LIT>" <EOL> fp = FlatPage . objects . create ( <EOL> url = "<STR_LIT>" , <EOL> title = "<STR_LIT>" , <EOL> content = "<STR_LIT>" , <EOL> enable_comments = False , <EOL> registration_required = False , <EOL> ) <EOL> fp . sites . add ( settings . SITE_ID ) <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertContains ( response , "<STR_LIT>" ) <EOL> @ override_settings ( <EOL> APPEND_SLASH = True , <EOL> LOGIN_URL = '<STR_LIT>' , <EOL> MIDDLEWARE_CLASSES = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) , <EOL> TEMPLATE_DIRS = ( <EOL> os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) , <EOL> ) , <EOL> SITE_ID = <NUM_LIT:1> , <EOL> ) <EOL> class FlatpageViewAppendSlashTests ( TestCase ) : <EOL> fixtures = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> urls = '<STR_LIT>' <EOL> def test_redirect_view_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertRedirects ( response , '<STR_LIT>' , status_code = <NUM_LIT> ) <EOL> def test_redirect_view_non_existent_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> def test_redirect_fallback_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> def test_redirect_fallback_non_existent_flatpage ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> def test_redirect_view_flatpage_special_chars ( self ) : <EOL> "<STR_LIT>" <EOL> fp = FlatPage . objects . create ( <EOL> url = "<STR_LIT>" , <EOL> title = "<STR_LIT>" , <EOL> content = "<STR_LIT>" , <EOL> enable_comments = False , <EOL> registration_required = False , <EOL> ) <EOL> fp . sites . add ( settings . SITE_ID ) <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertRedirects ( response , '<STR_LIT>' , status_code = <NUM_LIT> ) </s>
