Skip to content

Commit 8d528e7

Browse files
Update tests.py
1 parent efea089 commit 8d528e7

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

  • openwisp_controller/config/whois/tests

openwisp_controller/config/whois/tests/tests.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,11 +1190,15 @@ def _assert_no_js_errors():
11901190
self.fail("XSS vulnerability detected in WHOIS details admin view.")
11911191

11921192

1193-
class TestWHOISDeactivated(TransactionTestCase):
1193+
class TestWHOISDeactivated(
1194+
CreateWHOISMixin, WHOISTransactionMixin, TransactionTestCase
1195+
):
11941196
def setUp(self):
1197+
super().setUp()
11951198
self.device = self._create_device()
1196-
self.device.last_ip = "8.8.8.8" # public IP
1197-
self.device.save()
1199+
org_settings = self.device.organization.config_settings
1200+
org_settings.whois_enabled = True
1201+
org_settings.save()
11981202

11991203
@mock.patch.object(app_settings, "WHOIS_CONFIGURED", True)
12001204
@mock.patch("openwisp_controller.config.whois.service.fetch_whois_details.delay")
@@ -1210,6 +1214,7 @@ def test_process_ip_skips_when_deactivated(self, mock_task):
12101214
@mock.patch("openwisp_controller.config.whois.service.fetch_whois_details.delay")
12111215
def test_process_ip_runs_when_active(self, mock_task):
12121216
self.device._is_deactivated = False
1217+
self.device.last_ip = "8.8.8.8"
12131218

12141219
service = WHOISService(self.device)
12151220
service.process_ip_data_and_location()

0 commit comments

Comments
 (0)