<s> import functools <EOL> import unittest2 <EOL> from sentry import app <EOL> from sentry . db import get_backend <EOL> def with_settings ( ** settings ) : <EOL> def wrapped ( func ) : <EOL> @ functools . wraps ( func ) <EOL> def _wrapped ( * args , ** kwargs ) : <EOL> defaults = { } <EOL> for k , v in settings . iteritems ( ) : <EOL> defaults [ k ] = app . config . get ( k ) <EOL> app . config [ k ] = v <EOL> try : <EOL> return func ( * args , ** kwargs ) <EOL> finally : <EOL> for k , v in defaults . iteritems ( ) : <EOL> app . config [ k ] = v <EOL> return _wrapped <EOL> return wrapped <EOL> class BaseTest ( unittest2 . TestCase ) : <EOL> def setUp ( self ) : <EOL> app . config [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : <NUM_LIT:9> <EOL> } <EOL> } <EOL> app . config [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> app . db = get_backend ( app ) <EOL> app . db . conn . flushdb ( ) <EOL> self . client = app . test_client ( ) </s>
