<s> try : import simplejson as json <EOL> except ImportError : import json <EOL> from . base import * <EOL> class BearerTestCase ( BaseTestCase ) : <EOL> def test_00_bearer ( self ) : <EOL> client = DjangoTestClient ( ) <EOL> token = self . get_token ( ) <EOL> response = client . get ( <EOL> "<STR_LIT>" , <EOL> { } , <EOL> HTTP_AUTHORIZATION = "<STR_LIT>" % token ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> response = client . get ( <EOL> "<STR_LIT>" , <EOL> { } , <EOL> HTTP_AUTHORIZATION = "<STR_LIT>" % token ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> response = client . get ( <EOL> "<STR_LIT>" , <EOL> { } , <EOL> HTTP_AUTHORIZATION = "<STR_LIT>" % token ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> def test_01_json_bearer ( self ) : <EOL> client = DjangoTestClient ( ) <EOL> token = self . get_token ( ) <EOL> response = client . get ( <EOL> "<STR_LIT>" , <EOL> { } , <EOL> HTTP_AUTHORIZATION = "<STR_LIT>" % token ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertTrue ( "<STR_LIT:email>" in json . loads ( response . content ) ) <EOL> response = client . get ( <EOL> "<STR_LIT>" , <EOL> { } , <EOL> HTTP_AUTHORIZATION = "<STR_LIT>" % token ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> self . assertTrue ( "<STR_LIT:error>" in json . loads ( response . content ) ) <EOL> response = client . get ( <EOL> "<STR_LIT>" , <EOL> { } , <EOL> HTTP_AUTHORIZATION = "<STR_LIT>" % token ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> self . assertTrue ( "<STR_LIT:error>" in json . loads ( response . content ) ) <EOL> def test_02_automatic_fail ( self ) : <EOL> client = DjangoTestClient ( ) <EOL> token = self . get_token ( ) <EOL> response = client . get ( <EOL> "<STR_LIT>" , <EOL> { } , <EOL> HTTP_AUTHORIZATION = "<STR_LIT>" % token ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> response = client . get ( <EOL> "<STR_LIT>" , <EOL> { } , <EOL> HTTP_AUTHORIZATION = "<STR_LIT>" % token ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) </s>
