<s> from __future__ import absolute_import , unicode_literals <EOL> from ... unittest import TestCase <EOL> from oauthlib . oauth1 import RequestValidator <EOL> class RequestValidatorTests ( TestCase ) : <EOL> def test_not_implemented ( self ) : <EOL> v = RequestValidator ( ) <EOL> self . assertRaises ( NotImplementedError , v . get_client_secret , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . get_request_token_secret , <EOL> None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . get_access_token_secret , <EOL> None , None , None ) <EOL> self . assertRaises ( NotImplementedError , lambda : v . dummy_client ) <EOL> self . assertRaises ( NotImplementedError , lambda : v . dummy_request_token ) <EOL> self . assertRaises ( NotImplementedError , lambda : v . dummy_access_token ) <EOL> self . assertRaises ( NotImplementedError , v . get_rsa_key , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . get_default_realms , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . get_realms , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . get_redirect_uri , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . validate_client_key , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . validate_access_token , <EOL> None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . validate_request_token , <EOL> None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . verify_request_token , <EOL> None , None ) <EOL> self . assertRaises ( NotImplementedError , v . verify_realms , <EOL> None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . validate_timestamp_and_nonce , <EOL> None , None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . validate_redirect_uri , <EOL> None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . validate_realms , <EOL> None , None , None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . validate_requested_realms , <EOL> None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . validate_verifier , <EOL> None , None , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . save_access_token , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . save_request_token , None , None ) <EOL> self . assertRaises ( NotImplementedError , v . save_verifier , <EOL> None , None , None ) <EOL> def test_check_length ( self ) : <EOL> v = RequestValidator ( ) <EOL> for method in ( v . check_client_key , v . check_request_token , <EOL> v . check_access_token , v . check_nonce , v . check_verifier ) : <EOL> for not_valid in ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) : <EOL> self . assertFalse ( method ( not_valid ) ) <EOL> for valid in ( '<STR_LIT>' , ) : <EOL> self . assertTrue ( method ( valid ) ) <EOL> def test_check_realms ( self ) : <EOL> v = RequestValidator ( ) <EOL> self . assertFalse ( v . check_realms ( [ '<STR_LIT:foo>' ] ) ) <EOL> class FooRealmValidator ( RequestValidator ) : <EOL> @ property <EOL> def realms ( self ) : <EOL> return [ '<STR_LIT:foo>' ] <EOL> v = FooRealmValidator ( ) <EOL> self . assertTrue ( v . check_realms ( [ '<STR_LIT:foo>' ] ) ) </s>
