#NEWLINE# def test_protect( self ) : #NEWLINE# #INDENT# expected = { #NEWLINE# #INDENT# 'enabled' : True , #NEWLINE# 'required_status_checks' : { #NEWLINE# #INDENT# 'enforcement_level' : 'off' , #NEWLINE# 'contexts' : [ ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# required = expected [ 'required_status_checks' ] #NEWLINE# self . token_login ( ) #NEWLINE# cassette_name = self . cassette_name ( 'protect' ) #NEWLINE# with self . recorder . use_cassette ( cassette_name , ** self . betamax_kwargs ) : #NEWLINE# #INDENT# repository = self . gh . repository ( 'bboe' , 'github3.py' ) #NEWLINE# branch = repository . branch ( 'develop' ) #NEWLINE# branch . protect ( 'off' , [ ] ) #NEWLINE# assert ( branch . protection == expected ) #NEWLINE# branch . protect ( None , [ 'a' ] ) #NEWLINE# required [ 'contexts' ] = [ 'a' ] #NEWLINE# assert ( branch . protection == expected ) #NEWLINE# branch . protect ( 'everyone' ) #NEWLINE# required [ 'enforcement_level' ] = 'everyone' #NEWLINE# assert ( expected . protection == expected ) #NEWLINE# branch . protect ( None , [ ] ) #NEWLINE# required [ 'contexts' ] = [ ] #NEWLINE# assert ( branch . protection == expected )