Skip to content

Commit

Permalink
TST: cymru whois search domain issue
Browse files Browse the repository at this point in the history
  • Loading branch information
monoidic committed Apr 24, 2023
1 parent 08999cd commit e4f67a5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions intelmq/tests/bots/experts/cymru_whois/test_expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# -*- coding: utf-8 -*-
import json
import unittest
import unittest.mock

import dns.resolver
import dns.name

import intelmq.lib.test as test
from intelmq.bots.experts.cymru_whois.expert import CymruExpertBot
Expand Down Expand Up @@ -57,6 +61,9 @@
}
UNEXPECTED_UNICODE = {"__type": "Event",
"source.asn": 266522}
UNKNOWN_IP = {"__type": "Event",
"source.ip": "255.255.255.210",
}


@test.skip_redis()
Expand Down Expand Up @@ -113,6 +120,13 @@ def test_unexpected_unicode(self):
self.run_bot()
self.assertMessageEqual(0, UNEXPECTED_UNICODE)

def test_search_domain(self):
self.input_message = UNKNOWN_IP.copy()
dns.resolver.get_default_resolver()
with unittest.mock.patch.object(dns.resolver.default_resolver, 'search', [dns.name.Name('cert.ee.'.split('.'))]):
self.run_bot()
self.assertMessageEqual(0, UNKNOWN_IP)


if __name__ == '__main__': # pragma: no cover
unittest.main()

0 comments on commit e4f67a5

Please sign in to comment.