#NEWLINE# @ mock . patch ( 'certbot_nginx.configurator.tls_sni_01.NginxTlsSni01.perform' ) #NEWLINE# @ mock . patch ( 'certbot_nginx.configurator.NginxConfigurator.restart' ) #NEWLINE# def test_perform( self , mock_restart , mock_perform ) : #NEWLINE# #INDENT# achall1 = achallenges . KeyAuthorizationAnnotatedChallenge ( challb = messages . ChallengeBody ( chall = challenges . TLSSNI01 ( token = 'kNdwjwOeX0I_A8DXt9Msmg' ) , uri = 'https://ca.org/chall0_uri' , status = messages . Status ( 'pending' ) ) , domain = 'localhost' , account_key = self . rsa512jwk ) #NEWLINE# achall2 = achallenges . KeyAuthorizationAnnotatedChallenge ( challb = messages . ChallengeBody ( chall = challenges . TLSSNI01 ( token = 'm8TdO1qik4JVFtgPPurJmg' ) , uri = 'https://ca.org/chall1_uri' , status = messages . Status ( 'pending' ) ) , domain = 'example.com' , account_key = self . rsa512jwk ) #NEWLINE# expected = [ achall1 . response ( self . rsa512jwk ) , achall2 . response ( self . rsa512jwk ) ] #NEWLINE# mock_perform . return_value = expected #NEWLINE# responses = self . config . perform ( [ achall1 , expected ] ) #NEWLINE# self . assertEqual ( mock_perform . call_count , 1 ) #NEWLINE# self . assertEqual ( responses , expected ) #NEWLINE# self . assertEqual ( mock_restart . call_count , 1 )