<s> from webapp2_extras import securecookie <EOL> import test_base <EOL> class TestSecureCookie ( test_base . BaseTestCase ) : <EOL> def test_secure_cookie_serializer ( self ) : <EOL> serializer = securecookie . SecureCookieSerializer ( '<STR_LIT>' ) <EOL> serializer . _get_timestamp = lambda : <NUM_LIT:1> <EOL> value = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] <EOL> result = '<STR_LIT>' <EOL> rv = serializer . serialize ( '<STR_LIT:foo>' , value ) <EOL> self . assertEqual ( rv , result ) <EOL> rv = serializer . deserialize ( '<STR_LIT:foo>' , result ) <EOL> self . assertEqual ( rv , value ) <EOL> rv = serializer . deserialize ( '<STR_LIT:foo>' , None ) <EOL> self . assertEqual ( rv , None ) <EOL> rv = serializer . deserialize ( '<STR_LIT:foo>' , '<STR_LIT>' ) <EOL> self . assertEqual ( rv , None ) <EOL> rv = serializer . deserialize ( '<STR_LIT:foo>' , result + '<STR_LIT:foo>' ) <EOL> self . assertEqual ( rv , None ) <EOL> rv = serializer . deserialize ( '<STR_LIT:foo>' , result , max_age = - <NUM_LIT> ) <EOL> self . assertEqual ( rv , None ) <EOL> serializer2 = securecookie . SecureCookieSerializer ( '<STR_LIT:foo>' ) <EOL> serializer2 . _encode = lambda x : '<STR_LIT:foo>' <EOL> result2 = serializer2 . serialize ( '<STR_LIT:foo>' , value ) <EOL> rv2 = serializer2 . deserialize ( '<STR_LIT:foo>' , result2 ) <EOL> self . assertEqual ( rv2 , None ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_base . main ( ) </s>
