Fix unit tests

This commit is contained in:
Shreya 2021-02-26 22:39:32 +05:30
parent c0d2d5b2b6
commit 2f99631ed4
1 changed files with 3 additions and 5 deletions

View File

@ -1,6 +1,7 @@
import pytest
from nmb.NetBIOS import NetBIOS
from common.utils.exceptions import DomainControllerNameFetchError
from infection_monkey.exploit.zerologon_utils.vuln_assessment import \
get_dc_details
from infection_monkey.model.host import VictimHost
@ -38,8 +39,5 @@ def test_get_dc_details_no_netbios_names(host, monkeypatch):
stub_queryIPForName = _get_stub_queryIPForName(NETBIOS_NAMES)
monkeypatch.setattr(NetBIOS, "queryIPForName", stub_queryIPForName)
dc_ip, dc_name, dc_handle = get_dc_details(host)
assert dc_ip == IP
assert dc_name == ""
assert dc_handle == "\\\\"
with pytest.raises(DomainControllerNameFetchError):
dc_ip, dc_name, dc_handle = get_dc_details(host)