Skip to content

Commit efccfe0

Browse files
committed
[fix] Skip connection check when firmware image unchanged
1 parent 9cd4f01 commit efccfe0

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

openwisp_firmware_upgrader/base/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def clean(self):
409409
)
410410
}
411411
)
412-
if self.device.deviceconnection_set.count() < 1:
412+
if self.image_has_changed and self.device.deviceconnection_set.count() < 1:
413413
raise ValidationError(
414414
_(
415415
"This device does not have a related connection object defined "

openwisp_firmware_upgrader/tests/test_models.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,11 @@ def test_device_fw_no_connection(self):
177177
else:
178178
self.fail("ValidationError not raised")
179179

180-
def test_device_fw_credentials_removed_after_assignment(self):
180+
def test_device_fw_save_after_credentials_removed(self):
181181
"""Regression test for #250."""
182182
device_fw = self._create_device_firmware()
183-
device_fw.upgrade_options = {"n": True}
184183
device_fw.device.deviceconnection_set.all().delete()
185-
with self.assertRaises(ValidationError) as ctx:
186-
device_fw.full_clean()
187-
self.assertIn("connection", str(ctx.exception).lower())
184+
device_fw.full_clean()
188185

189186
def test_invalid_board(self):
190187
image = FIRMWARE_IMAGE_MAP[self.TPLINK_4300_IMAGE]

0 commit comments

Comments
 (0)