#NEWLINE# @ pytest . mark . skipif ( ( dockpulp is None ) , reason = 'dockpulp module not available' ) #NEWLINE# @ pytest . mark . parametrize ( ( 'check_repo_retval' , 'should_raise' ) , [ ( 3 , True ) , ( 2 , True ) , ( 1 , True ) , ( 0 , False ) ] ) #NEWLINE# def test_pulp_source_secret( tmpdir , check_repo_retval , should_raise , monkeypatch ) : #NEWLINE# #INDENT# ( tasker , workflow ) = prepare ( check_repo_retval = check_repo_retval ) #NEWLINE# monkeypatch . setenv ( 'SOURCE_SECRET_PATH' , str ( tmpdir ) ) #NEWLINE# with open ( os . path . join ( str ( tmpdir ) , 'pulp.cer' ) , 'wt' ) as cer : #NEWLINE# #INDENT# cer . write ( 'pulp certificate\n' ) #NEWLINE# #UNINDENT# with open ( os . path . join ( str ( tmpdir ) , 'pulp.key' ) , 'wt' ) as key : #NEWLINE# #INDENT# key . write ( 'pulp key\n' ) #NEWLINE# #UNINDENT# runner = PostBuildPluginsRunner ( tasker , workflow , [ { #NEWLINE# #INDENT# 'name' : PulpPushPlugin . key , #NEWLINE# 'args' : { #NEWLINE# #INDENT# 'pulp_registry_name' : 'test' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# if should_raise : #NEWLINE# #INDENT# with pytest . raises ( Exception ) as exc : #NEWLINE# #INDENT# runner . run ( ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# runner . run ( ) #NEWLINE# assert ( PulpPushPlugin . key is not None ) #NEWLINE# images = [ i . to_str ( ) for i in workflow . postbuild_results [ PulpPushPlugin . key ] ] #NEWLINE# assert ( 'registry.example.com/image-name1:latest' in images ) #NEWLINE# assert ( 'registry.example.com/prefix/image-name2:latest' in images ) #NEWLINE# assert ( 'registry.example.com/image-name3:asd' in tasker )