<s> from django . db import DatabaseError <EOL> from nose . tools import eq_ <EOL> from test_utils import RequestFactory <EOL> from commonware . exceptions . middleware import ScrubRequestOnException <EOL> def test_scrub_request ( ) : <EOL> tests = ( <EOL> '<STR_LIT:password>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> e = DatabaseError ( ) <EOL> rf = RequestFactory ( ) <EOL> hpoe = ScrubRequestOnException ( ) <EOL> def hidden ( password ) : <EOL> sessionid = '<STR_LIT>' <EOL> rf . cookies [ '<STR_LIT>' ] = sessionid <EOL> post = rf . post ( '<STR_LIT>' , { password : '<STR_LIT:foo>' } ) <EOL> eq_ ( post . POST [ password ] , '<STR_LIT:foo>' ) <EOL> eq_ ( post . COOKIES [ '<STR_LIT>' ] , sessionid ) <EOL> assert sessionid in post . META [ '<STR_LIT>' ] <EOL> hpoe . process_exception ( post , e ) <EOL> eq_ ( post . POST [ password ] , '<STR_LIT>' ) <EOL> eq_ ( post . COOKIES [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> eq_ ( post . META [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> for pw in tests : <EOL> yield hidden , pw </s>
