<s> import unittest <EOL> from werkzeug . exceptions import BadRequest <EOL> from . test_client import TestClient <EOL> from api . app import create_app <EOL> from api . models import db , User <EOL> from api . errors import ValidationError <EOL> class TestAPI ( unittest . TestCase ) : <EOL> default_username = '<STR_LIT>' <EOL> default_password = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> self . app = create_app ( '<STR_LIT>' ) <EOL> self . ctx = self . app . app_context ( ) <EOL> self . ctx . push ( ) <EOL> db . drop_all ( ) <EOL> db . create_all ( ) <EOL> u = User ( username = self . default_username , <EOL> password = self . default_password ) <EOL> db . session . add ( u ) <EOL> db . session . commit ( ) <EOL> self . client = TestClient ( self . app , u . generate_auth_token ( ) , '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> db . session . remove ( ) <EOL> db . drop_all ( ) <EOL> self . ctx . pop ( ) <EOL> def test_password_auth ( self ) : <EOL> self . app . config [ '<STR_LIT>' ] = False <EOL> good_client = TestClient ( self . app , self . default_username , <EOL> self . default_password ) <EOL> rv , json = good_client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . app . config [ '<STR_LIT>' ] = True <EOL> u = User . query . get ( <NUM_LIT:1> ) <EOL> good_client = TestClient ( self . app , u . generate_auth_token ( ) , '<STR_LIT>' ) <EOL> rv , json = good_client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> def test_bad_auth ( self ) : <EOL> bad_client = TestClient ( self . app , '<STR_LIT:abc>' , '<STR_LIT>' ) <EOL> rv , json = bad_client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> self . app . config [ '<STR_LIT>' ] = True <EOL> bad_client = TestClient ( self . app , '<STR_LIT>' , '<STR_LIT>' ) <EOL> rv , json = bad_client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> def test_students ( self ) : <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT>' ] == [ ] ) <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> susan_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( susan_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT:name>' ] == '<STR_LIT>' ) <EOL> self . assertTrue ( json [ '<STR_LIT:url>' ] == susan_url ) <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> david_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( david_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT:name>' ] == '<STR_LIT>' ) <EOL> self . assertTrue ( json [ '<STR_LIT:url>' ] == david_url ) <EOL> rv , json = self . client . post ( '<STR_LIT>' , data = { } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> self . assertRaises ( ValidationError , lambda : <EOL> self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT>' : '<STR_LIT>' } ) ) <EOL> rv , json = self . client . put ( david_url , data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( david_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT:name>' ] == '<STR_LIT>' ) <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( susan_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( david_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:2> ) <EOL> rv , json = self . client . delete ( susan_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertFalse ( susan_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( david_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:1> ) <EOL> def test_classes ( self ) : <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT>' ] == [ ] ) <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> algebra_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( algebra_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT:name>' ] == '<STR_LIT>' ) <EOL> self . assertTrue ( json [ '<STR_LIT:url>' ] == algebra_url ) <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> lit_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( lit_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT:name>' ] == '<STR_LIT>' ) <EOL> self . assertTrue ( json [ '<STR_LIT:url>' ] == lit_url ) <EOL> rv , json = self . client . post ( '<STR_LIT>' , data = { } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> self . assertRaises ( ValidationError , lambda : <EOL> self . client . post ( '<STR_LIT>' , data = { '<STR_LIT>' : '<STR_LIT>' } ) ) <EOL> rv , json = self . client . put ( lit_url , data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( lit_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT:name>' ] == '<STR_LIT>' ) <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( lit_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:2> ) <EOL> rv , json = self . client . delete ( lit_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertFalse ( lit_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:1> ) <EOL> def test_registrations ( self ) : <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> susan_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> david_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> algebra_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> lit_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT>' : susan_url , <EOL> '<STR_LIT:class>' : algebra_url } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> susan_in_algebra_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT>' : susan_url , <EOL> '<STR_LIT:class>' : lit_url } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> susan_in_lit_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT>' : david_url , <EOL> '<STR_LIT:class>' : algebra_url } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> david_in_algebra_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( susan_in_lit_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( json [ '<STR_LIT>' ] == susan_url ) <EOL> self . assertTrue ( json [ '<STR_LIT:class>' ] == lit_url ) <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( susan_in_algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( susan_in_lit_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( david_in_algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:3> ) <EOL> rv , json = self . client . post ( '<STR_LIT>' , data = { } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> self . assertRaises ( ValidationError , lambda : <EOL> self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT>' : david_url } ) ) <EOL> self . assertRaises ( ValidationError , lambda : <EOL> self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:class>' : algebra_url } ) ) <EOL> self . assertRaises ( ValidationError , lambda : <EOL> self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT>' : david_url , '<STR_LIT:class>' : '<STR_LIT>' } ) ) <EOL> self . assertRaises ( ValidationError , lambda : <EOL> self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT>' : david_url , <EOL> '<STR_LIT:class>' : algebra_url + '<STR_LIT:1>' } ) ) <EOL> db . session . remove ( ) <EOL> rv , json = self . client . get ( susan_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> susans_reg_url = json [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( susans_reg_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( susan_in_algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( susan_in_lit_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:2> ) <EOL> rv , json = self . client . get ( david_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> davids_reg_url = json [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( davids_reg_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( david_in_algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:1> ) <EOL> rv , json = self . client . get ( algebra_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> algebras_reg_url = json [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( algebras_reg_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( susan_in_algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( david_in_algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:2> ) <EOL> rv , json = self . client . get ( lit_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> lits_reg_url = json [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( lits_reg_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( susan_in_lit_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:1> ) <EOL> rv , json = self . client . delete ( susan_in_algebra_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . delete ( david_in_algebra_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertFalse ( susan_in_algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( susan_in_lit_url in json [ '<STR_LIT>' ] ) <EOL> self . assertFalse ( david_in_algebra_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:1> ) <EOL> rv , json = self . client . delete ( susan_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:0> ) <EOL> def test_rate_limits ( self ) : <EOL> self . app . config [ '<STR_LIT>' ] = True <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( '<STR_LIT>' in rv . headers ) <EOL> self . assertTrue ( '<STR_LIT>' in rv . headers ) <EOL> self . assertTrue ( '<STR_LIT>' in rv . headers ) <EOL> self . assertTrue ( int ( rv . headers [ '<STR_LIT>' ] ) == int ( rv . headers [ '<STR_LIT>' ] ) + <NUM_LIT:1> ) <EOL> while int ( rv . headers [ '<STR_LIT>' ] ) > <NUM_LIT:0> : <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> def test_pagination ( self ) : <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> one_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> two_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> three_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> four_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> five_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( one_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( two_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:2> ) <EOL> self . assertTrue ( '<STR_LIT>' in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( json [ '<STR_LIT>' ] [ '<STR_LIT>' ] == <NUM_LIT:5> ) <EOL> self . assertTrue ( '<STR_LIT>' in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( json [ '<STR_LIT>' ] [ '<STR_LIT>' ] is None ) <EOL> first_url = json [ '<STR_LIT>' ] [ '<STR_LIT>' ] . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> last_url = json [ '<STR_LIT>' ] [ '<STR_LIT>' ] . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> next_url = json [ '<STR_LIT>' ] [ '<STR_LIT>' ] . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> rv , json = self . client . get ( first_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( one_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( two_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:2> ) <EOL> rv , json = self . client . get ( next_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( three_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( four_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:2> ) <EOL> next_url = json [ '<STR_LIT>' ] [ '<STR_LIT>' ] . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> rv , json = self . client . get ( next_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( five_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:1> ) <EOL> rv , json = self . client . get ( last_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( five_url in json [ '<STR_LIT>' ] ) <EOL> self . assertTrue ( len ( json [ '<STR_LIT>' ] ) == <NUM_LIT:1> ) <EOL> def test_cache_control ( self ) : <EOL> client = TestClient ( self . app , self . default_username , <EOL> self . default_password ) <EOL> rv , json = client . get ( '<STR_LIT>' ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> self . assertTrue ( '<STR_LIT>' in rv . headers ) <EOL> cache = [ c . strip ( ) for c in rv . headers [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) ] <EOL> self . assertTrue ( '<STR_LIT>' in cache ) <EOL> self . assertTrue ( '<STR_LIT>' in cache ) <EOL> self . assertTrue ( '<STR_LIT>' in cache ) <EOL> self . assertTrue ( len ( cache ) == <NUM_LIT:3> ) <EOL> def test_etag ( self ) : <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> one_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . post ( '<STR_LIT>' , <EOL> data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> two_url = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( one_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> one_etag = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( two_url ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> two_etag = rv . headers [ '<STR_LIT>' ] <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : one_etag } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : one_etag + '<STR_LIT:U+002CU+0020>' + two_etag } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : two_etag } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : two_etag + '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : one_etag } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : one_etag + '<STR_LIT:U+002CU+0020>' + two_etag } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : two_etag } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT> ) <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : '<STR_LIT:*>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . put ( one_url , data = { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) <EOL> rv , json = self . client . get ( one_url , headers = { <EOL> '<STR_LIT>' : one_etag } ) <EOL> self . assertTrue ( rv . status_code == <NUM_LIT:200> ) </s>
