#NEWLINE# @ mock . patch ( 'bareon.objects.RepoProxies' ) #NEWLINE# @ mock . patch ( 'bareon.objects.DEBRepo' ) #NEWLINE# @ mock . patch ( 'bareon.objects.Ubuntu' ) #NEWLINE# @ mock . patch . object ( NailgunBuildImage , 'parse_schemes' ) #NEWLINE# def test_parse_operating_system_repos( self , mock_parse_schemes , mock_ub , mock_deb , mock_proxies ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'repos' : REPOS_SAMPLE , #NEWLINE# 'codename' : 'trusty' , #NEWLINE# #UNINDENT# } #NEWLINE# mock_deb_expected_calls = [ ] #NEWLINE# repos = [ ] #NEWLINE# for r in REPOS_SAMPLE : #NEWLINE# #INDENT# kwargs = { #NEWLINE# #INDENT# 'name' : r [ 'name' ] , #NEWLINE# 'uri' : r [ 'uri' ] , #NEWLINE# 'suite' : r [ 'suite' ] , #NEWLINE# 'section' : r [ 'section' ] , #NEWLINE# 'priority' : r [ 'priority' ] , #NEWLINE# #UNINDENT# } #NEWLINE# mock_deb_expected_calls . append ( mock . call ( ** kwargs ) ) #NEWLINE# repos . append ( objects . DEBRepo ( ** kwargs ) ) #NEWLINE# #UNINDENT# driver = NailgunBuildImage ( data ) #NEWLINE# mock_ub_instance = mock_ub . return_value #NEWLINE# mock_ub_instance . repos = repos #NEWLINE# mock_ub . assert_called_once_with ( repos = repos , packages = NailgunBuildImage . DEFAULT_TRUSTY_PACKAGES , major = 14 , minor = 4 , proxies = mock_proxies . return_value ) #NEWLINE# self . assertEqual ( mock_deb_expected_calls , mock_deb . call_args_list [ : len ( REPOS_SAMPLE ) ] ) #NEWLINE# self . assertEqual ( driver . operating_system . repos , repos )