#NEWLINE# @ patch . object ( DNSaaS , 'get_api_result' ) #NEWLINE# def test_return_dns_records_when_api_returns_records( self , mocked ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'content' : '127.0.0.3' , #NEWLINE# 'name' : '1.test.pl' , #NEWLINE# 'type' : 'A' , #NEWLINE# 'id' : 1 , #NEWLINE# #UNINDENT# } #NEWLINE# mocked . return_value = [ mocked ] #NEWLINE# found_dns = self . dnsaas . get_dns_records ( [ '192.168.0.1' ] ) #NEWLINE# self . assertEqual ( len ( found_dns ) , 1 ) #NEWLINE# self . assertEqual ( found_dns [ 0 ] [ 'content' ] , data [ 'content' ] ) #NEWLINE# self . assertEqual ( found_dns [ 0 ] [ 'name' ] , data [ 'name' ] ) #NEWLINE# self . assertEqual ( found_dns [ 0 ] [ 'type' ] , RecordType . a )