#NEWLINE# def test_image( monkeypatch , tmpdir ) : #NEWLINE# #INDENT# response = MagicMock ( ) #NEWLINE# response . json . return_value = [ { #NEWLINE# #INDENT# 'name' : '1.0' , #NEWLINE# 'team' : 'stups' , #NEWLINE# 'artifact' : 'kio' , #NEWLINE# #UNINDENT# } ] #NEWLINE# runner = CliRunner ( ) #NEWLINE# monkeypatch . setattr ( 'stups_cli.config.load_config' , ( lambda x : { #NEWLINE# #INDENT# 'url' : 'foobar' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# monkeypatch . setattr ( 'zign.api.get_token' , MagicMock ( return_value = 'tok123' ) ) #NEWLINE# monkeypatch . setattr ( 'os.path.expanduser' , ( lambda x : x . replace ( '~' , str ( tmpdir ) ) ) ) #NEWLINE# monkeypatch . setattr ( 'pierone.api.session.get' , MagicMock ( return_value = response ) ) #NEWLINE# with runner . isolated_filesystem ( ) : #NEWLINE# #INDENT# result = runner . invoke ( cli , [ 'image' , 'abcd' ] , catch_exceptions = False ) #NEWLINE# assert ( 'kio' in result . output ) #NEWLINE# assert ( 'stups' in result . output ) #NEWLINE# assert ( '1.0' in result . output )