#NEWLINE# @ pytest . mark . parametrize ( ( 'root' , 'koji_ssl_certs' , 'expected_string' , 'expected_file' , 'proxy' ) , [ ( 'http://example.com' , False , None , None , None ) , ( 'http://example.com' , False , None , None , 'http://proxy.example.com' ) , ( 'https://nosuchwebsiteforsure.com' , False , 'sslverify=0' , None , None ) , ( 'https://nosuchwebsiteforsure.com' , False , 'sslverify=0' , None , 'http://proxy.example.com' ) ] ) #NEWLINE# def test_koji_plugin( self , tmpdir , root , koji_ssl_certs , expected_string , expected_file , proxy ) : #NEWLINE# #INDENT# ( tasker , workflow ) = prepare ( ) #NEWLINE# args = { #NEWLINE# #INDENT# 'target' : KOJI_TARGET , #NEWLINE# 'hub' : '' , #NEWLINE# 'root' : root , #NEWLINE# 'proxy' : proxy , #NEWLINE# #UNINDENT# } #NEWLINE# if koji_ssl_certs : #NEWLINE# #INDENT# args [ 'koji_ssl_certs' ] = str ( tmpdir ) #NEWLINE# with open ( '{}/ca' . format ( tmpdir ) , 'w' ) as ca_fd : #NEWLINE# #INDENT# ca_fd . write ( 'ca' ) #NEWLINE# #UNINDENT# #UNINDENT# runner = PreBuildPluginsRunner ( tasker , workflow , [ { #NEWLINE# #INDENT# 'name' : KojiPlugin . key , #NEWLINE# 'args' : args , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# runner . run ( ) #NEWLINE# repofile = '/etc/yum.repos.d/target.repo' #NEWLINE# assert ( repofile in workflow . files ) #NEWLINE# content = workflow . files [ repofile ] #NEWLINE# assert content . startswith ( '[atomic-reactor-koji-plugin-target]\n' ) #NEWLINE# assert ( 'gpgcheck=0\n' in content ) #NEWLINE# assert ( 'enabled=1\n' in content ) #NEWLINE# assert ( 'name=atomic-reactor-koji-plugin-target\n' in content ) #NEWLINE# assert ( ( 'baseurl=%s/repos/tag/2/$basearch\n' % root ) in content ) #NEWLINE# if proxy : #NEWLINE# #INDENT# assert ( ( 'proxy=%s' % proxy ) in content ) #NEWLINE# #UNINDENT# if expected_string : #NEWLINE# #INDENT# assert ( expected_string in content ) #NEWLINE# #UNINDENT# if expected_file : #NEWLINE# #INDENT# assert ( expected_file in workflow . files )