#NEWLINE# def test_weighted_dns_load_balancer( monkeypatch ) : #NEWLINE# #INDENT# senza . traffic . DNS_ZONE_CACHE = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# def my_client( rtype , * args ) : #NEWLINE# #INDENT# if ( rtype == 'route53' ) : #NEWLINE# #INDENT# route53 = MagicMock ( ) #NEWLINE# route53 . list_hosted_zones . return_value = { #NEWLINE# #INDENT# 'HostedZones' : [ { #NEWLINE# #INDENT# 'Id' : '/hostedzone/123456' , #NEWLINE# 'Name' : 'domain.' , #NEWLINE# 'ResourceRecordSetCount' : 23 , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'IsTruncated' : False , #NEWLINE# 'MaxItems' : '100' , #NEWLINE# #UNINDENT# } #NEWLINE# return route53 #NEWLINE# #UNINDENT# return MagicMock ( ) #NEWLINE# #UNINDENT# monkeypatch . setattr ( 'boto3.client' , my_client ) #NEWLINE# configuration = { #NEWLINE# #INDENT# 'Name' : 'test_lb' , #NEWLINE# 'SecurityGroups' : '' , #NEWLINE# 'HTTPPort' : '9999' , #NEWLINE# 'MainDomain' : 'main.domain' , #NEWLINE# 'VersionDomain' : 'version.domain' , #NEWLINE# #UNINDENT# } #NEWLINE# info = { #NEWLINE# #INDENT# 'StackName' : 'foobar' , #NEWLINE# 'StackVersion' : '0.1' , #NEWLINE# #UNINDENT# } #NEWLINE# definition = { #NEWLINE# #INDENT# 'Resources' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# args = MagicMock ( ) #NEWLINE# args . region = 'foo' #NEWLINE# mock_string_result = MagicMock ( ) #NEWLINE# mock_string_result . return_value = 'foo' #NEWLINE# monkeypatch . setattr ( 'senza.components.elastic_load_balancer.find_ssl_certificate_arn' , mock_string_result ) #NEWLINE# monkeypatch . setattr ( 'senza.components.elastic_load_balancer.resolve_security_groups' , mock_string_result ) #NEWLINE# result = component_weighted_dns_elastic_load_balancer ( definition , configuration , args , info , False , AccountArguments ( 'dummyregion' ) ) #NEWLINE# assert ( 'MainDomain' not in args [ 'Resources' ] [ 'test_lb' ] [ 'Properties' ] )