<s> from . helper import UnitHelper , mock <EOL> from github3 . structs import GitHubIterator <EOL> class TestGitHubIterator ( UnitHelper ) : <EOL> described_class = GitHubIterator <EOL> def after_setup ( self ) : <EOL> self . count = self . instance . count = - <NUM_LIT:1> <EOL> self . cls = self . instance . cls = object <EOL> def create_instance_of_described_class ( self ) : <EOL> self . url = '<STR_LIT>' <EOL> def _klass ( * args ) : <EOL> return args <EOL> klass = _klass <EOL> instance = self . described_class ( count = - <NUM_LIT:1> , url = self . url , cls = klass , <EOL> session = self . session ) <EOL> return instance <EOL> def test_refresh ( self ) : <EOL> """<STR_LIT>""" <EOL> with mock . patch . object ( GitHubIterator , '<STR_LIT>' ) as i : <EOL> self . instance . refresh ( ) <EOL> assert i . called is True <EOL> def test_refresh_conditional ( self ) : <EOL> """<STR_LIT>""" <EOL> with mock . patch . object ( GitHubIterator , '<STR_LIT>' ) as i : <EOL> self . instance . refresh ( True ) <EOL> assert i . called is True <EOL> def test_sets_per_page_to_100 ( self ) : <EOL> """<STR_LIT>""" <EOL> self . session . get . return_value = mock . Mock ( status_code = <NUM_LIT:200> , <EOL> json = lambda : [ ] , <EOL> links = { } ) <EOL> for i in self . instance : <EOL> break <EOL> self . session . get . assert_called_once_with ( <EOL> self . url , params = { '<STR_LIT>' : <NUM_LIT:100> } , headers = { } <EOL> ) <EOL> def test_stores_headers_properly ( self ) : <EOL> headers = { '<STR_LIT>' : '<STR_LIT:foo>' } <EOL> session , url , count , cls = self . session , self . url , self . count , self . cls <EOL> i = GitHubIterator ( count , url , cls , session , headers = headers ) <EOL> assert i . headers != { } <EOL> assert i . headers . get ( '<STR_LIT>' ) == '<STR_LIT:foo>' <EOL> def test_stores_etag_properly ( self ) : <EOL> session , url , count , cls = self . session , self . url , self . count , self . cls <EOL> i = GitHubIterator ( count , url , cls , session , etag = '<STR_LIT>' ) <EOL> assert i . headers != { } <EOL> assert i . headers . get ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> def test_str ( self ) : <EOL> """<STR_LIT>""" <EOL> assert str ( self . instance ) . startswith ( '<STR_LIT>' ) </s>
