Skip to content

Commit

Permalink
test: add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajasnosz committed Dec 19, 2024
1 parent 3589a15 commit b3642db
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/snmp/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,29 +292,29 @@ def test_trap_reverse_dns_lookup(

@patch("splunk_connect_for_snmp.snmp.tasks.IPv6_ENABLED", True)
# @patch("splunk_connect_for_snmp.snmp.manager.Poller.__init__")
# @patch("time.time")
@patch("time.time")
def test_format_ipv4_address(
self,
# m_time,
m_time,
# m_poller,
ipv6_enabled,
m_mongo_client,
):
# m_poller.return_value = None
from splunk_connect_for_snmp.snmp.tasks import format_ipv4_address

# m_time.return_value = 1640692955.365186
m_time.return_value = 1640692955.365186

ip_address = "::ffff:172.31.20.76"
host = format_ipv4_address(ip_address)
self.assertEqual(host, "172.31.20.76")

# @patch("splunk_connect_for_snmp.snmp.manager.Poller.__init__")
# @patch("time.time")
@patch("time.time")
# @patch("splunk_connect_for_snmp.snmp.tasks.IPv6_ENABLED", False)
def test_format_ipv4_address_disabled(
self,
# m_time,
m_time,
# m_poller,
# ipv6_enabled,
m_mongo_client,
Expand All @@ -329,19 +329,19 @@ def test_format_ipv4_address_disabled(
self.assertEqual(host, "::ffff:172.31.20.76")

# @patch("splunk_connect_for_snmp.snmp.manager.Poller.__init__")
# @patch("time.time")
@patch("time.time")
# @patch("splunk_connect_for_snmp.snmp.tasks.IPv6_ENABLED", True)
def test_format_ipv4_address_ipv6(
self,
# m_time,
m_time,
# m_poller,
# ipv6_enabled,
m_mongo_client,
):
# m_poller.return_value = None
from splunk_connect_for_snmp.snmp.tasks import format_ipv4_address

# m_time.return_value = 1640692955.365186
m_time.return_value = 1640692955.365186

ip_address = "fd02::b24a:409e:a35e:b580"
host = format_ipv4_address(ip_address)
Expand Down

0 comments on commit b3642db

Please sign in to comment.