#NEWLINE# def test_build_image( self ) : #NEWLINE# #INDENT# build_image = 'registry.example.com/buildroot:2.0' #NEWLINE# with NamedTemporaryFile ( mode = 'wt' ) as fp : #NEWLINE# #INDENT# fp . write ( '\n[general]\nbuild_json_dir = {build_json_dir}\n[default]\nopenshift_url = /\nsources_command = /bin/true\nvendor = Example, Inc\nregistry_uri = registry.example.com\nbuild_host = localhost\nauthoritative_registry = localhost\ndistribution_scope = private\nbuild_type = prod\nbuild_image = {build_image}\n' . format ( build_json_dir = 'inputs' , build_image = build_image ) ) #NEWLINE# fp . flush ( ) #NEWLINE# config = Configuration ( fp . name ) #NEWLINE# osbs = OSBS ( config , config ) #NEWLINE# #UNINDENT# assert ( config . get_build_image ( ) == build_image ) #NEWLINE# class MockParser ( object ) : #NEWLINE# #INDENT# labels = { #NEWLINE# #INDENT# 'Name' : 'fedora23/something' , #NEWLINE# #UNINDENT# } #NEWLINE# baseimage = 'fedora23/python' #NEWLINE# #UNINDENT# flexmock ( utils ) . should_receive ( 'get_df_parser' ) . with_args ( TEST_GIT_URI , TEST_GIT_REF , git_branch = TEST_GIT_BRANCH ) . and_return ( MockParser ( ) ) #NEWLINE# def request_as_response( request ) : #NEWLINE# #INDENT# request . json = request . render ( ) #NEWLINE# return request #NEWLINE# #UNINDENT# flexmock ( OSBS , _create_build_config_and_build = build_image ) #NEWLINE# req = osbs . create_prod_build ( TEST_GIT_URI , TEST_GIT_REF , TEST_GIT_BRANCH , TEST_USER , TEST_COMPONENT , TEST_TARGET , TEST_ARCH ) #NEWLINE# img = req . json [ 'spec' ] [ 'strategy' ] [ 'customStrategy' ] [ 'from' ] [ 'name' ] #NEWLINE# assert ( img == build_image )