Skip to content

Commit 01f39bd

Browse files
committed
update db unit tests
1 parent 7c5837d commit 01f39bd

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

tests/test_alert_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def test_set_evidence(evidence_exists, whitelisted, expected):
374374
def test_update_max_threat_level(
375375
max_threat_level, cur_threat_level, expected_max
376376
):
377-
db = ModuleFactory().create_db_manager_obj(6393, flush_db=True)
377+
db = ModuleFactory().create_db_manager_obj(6379, flush_db=True)
378378
profileid = "profile_192.168.1.1"
379379
db.set_max_threat_level(profileid, max_threat_level)
380380
assert (

tests/test_database.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
)
3939

4040

41-
def test_setInfoForDomains():
42-
"""tests setInfoForDomains, setNewDomain and getDomainData"""
43-
db = ModuleFactory().create_db_manager_obj(6385, flush_db=True)
41+
def test_set_info_for_domains():
42+
"""tests set_info_for_domains, setNewDomain and get_domain_data"""
43+
db = ModuleFactory().create_db_manager_obj(6379, flush_db=True)
4444
domain = "www.google.com"
4545
domain_data = {"threatintelligence": "sample data"}
4646
db.set_info_for_domains(domain, domain_data)
@@ -51,7 +51,7 @@ def test_setInfoForDomains():
5151

5252

5353
def test_subscribe():
54-
db = ModuleFactory().create_db_manager_obj(6386, flush_db=True)
54+
db = ModuleFactory().create_db_manager_obj(6379, flush_db=True)
5555
# invalid channel
5656
assert db.subscribe("invalid_channel") is False
5757
# valid channel, shoud return a pubsub object
@@ -60,7 +60,7 @@ def test_subscribe():
6060

6161
def test_profile_moddule_labels():
6262
"""tests set and get_profile_module_label"""
63-
db = ModuleFactory().create_db_manager_obj(6387, flush_db=True)
63+
db = ModuleFactory().create_db_manager_obj(6379, flush_db=True)
6464
module_label = "malicious"
6565
module_name = "test"
6666
db.set_module_label_for_profile(profileid, module_name, module_label)
@@ -73,7 +73,7 @@ def test_add_mac_addr_with_new_ipv4():
7373
"""
7474
adding an ipv4 to no cached ip
7575
"""
76-
db = ModuleFactory().create_db_manager_obj(6388, flush_db=True)
76+
db = ModuleFactory().create_db_manager_obj(6379, flush_db=True)
7777
ipv4 = "192.168.1.5"
7878
profileid_ipv4 = f"profile_{ipv4}"
7979
mac_addr = "00:00:5e:00:53:af"
@@ -96,7 +96,7 @@ def test_add_mac_addr_with_existing_ipv4():
9696
"""
9797
adding an ipv4 to a cached ipv4
9898
"""
99-
db = ModuleFactory().create_db_manager_obj(6389, flush_db=True)
99+
db = ModuleFactory().create_db_manager_obj(6379, flush_db=True)
100100
ipv4 = "192.168.1.5"
101101
mac_addr = "00:00:5e:00:53:af"
102102
db.rdb.is_gw_mac = Mock(return_value=False)
@@ -115,7 +115,7 @@ def test_add_mac_addr_with_ipv6_association():
115115
"""
116116
adding an ipv6 to a cached ipv4
117117
"""
118-
db = ModuleFactory().create_db_manager_obj(6390, flush_db=True)
118+
db = ModuleFactory().create_db_manager_obj(6379, flush_db=True)
119119
ipv4 = "192.168.1.5"
120120
profile_ipv4 = "profile_192.168.1.5"
121121
mac_addr = "00:00:5e:00:53:af"
@@ -143,7 +143,7 @@ def test_add_mac_addr_with_ipv6_association():
143143

144144

145145
def test_get_the_other_ip_version():
146-
db = ModuleFactory().create_db_manager_obj(6391, flush_db=True)
146+
db = ModuleFactory().create_db_manager_obj(6379, flush_db=True)
147147
# profileid is ipv4
148148
ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
149149
db.set_ipv6_of_profile(profileid, ipv6)

0 commit comments

Comments
 (0)