<s> import warnings <EOL> from paste . fixture import TestApp <EOL> from paste . registry import RegistryManager <EOL> from __init__ import TestWSGIController <EOL> def make_cache_controller_app ( ) : <EOL> from pylons . testutil import ControllerWrap , SetupCacheGlobal <EOL> from pylons . decorators import jsonify <EOL> from pylons . controllers import WSGIController <EOL> class CacheController ( WSGIController ) : <EOL> @ jsonify <EOL> def test_bad_json ( self ) : <EOL> return [ "<STR_LIT>" ] <EOL> @ jsonify <EOL> def test_bad_json2 ( self ) : <EOL> return ( "<STR_LIT>" , ) <EOL> @ jsonify <EOL> def test_good_json ( self ) : <EOL> return dict ( fred = <NUM_LIT> ) <EOL> environ = { } <EOL> app = ControllerWrap ( CacheController ) <EOL> app = sap = SetupCacheGlobal ( app , environ ) <EOL> app = RegistryManager ( app ) <EOL> app = TestApp ( app ) <EOL> return app , environ <EOL> class TestJsonifyDecorator ( TestWSGIController ) : <EOL> def setUp ( self ) : <EOL> self . app , environ = make_cache_controller_app ( ) <EOL> TestWSGIController . setUp ( self ) <EOL> environ . update ( self . environ ) <EOL> warnings . simplefilter ( '<STR_LIT:error>' , Warning ) <EOL> def tearDown ( self ) : <EOL> warnings . simplefilter ( '<STR_LIT>' , Warning ) <EOL> def test_bad_json ( self ) : <EOL> for action in '<STR_LIT>' , '<STR_LIT>' : <EOL> try : <EOL> response = self . get_response ( action = action ) <EOL> except Warning , msg : <EOL> assert '<STR_LIT>' in msg [ <NUM_LIT:0> ] <EOL> def test_good_json ( self ) : <EOL> response = self . get_response ( action = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in response <EOL> assert response . header ( '<STR_LIT:Content-Type>' ) == '<STR_LIT>' </s>
