Skip to content

Commit

Permalink
[fix] Updated with changes #576
Browse files Browse the repository at this point in the history
Fixes #576
  • Loading branch information
praptisharma28 committed May 30, 2024
1 parent a73cd94 commit b450635
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions openwisp_monitoring/device/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,6 @@ def handle_critical_metric(cls, instance, **kwargs):
device_monitoring = cls.objects.get(device=instance.content_object)
if not instance.is_active or kwargs.get('signal') == post_delete:
device_monitoring.update_status('unknown')
elif kwargs.get('signal') == post_save and instance.is_active:
device_monitoring.update_status('ok')
except cls.DoesNotExist:
pass

Expand Down
6 changes: 3 additions & 3 deletions openwisp_monitoring/device/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,12 @@ def test_disabling_critical_check(self):
dm.refresh_from_db()
self.assertEqual(dm.status, 'unknown')
with self.subTest(
"Ensure status doesn't change on saving active critical check"
'Ensure status does not change on saving active critical check'
):
ping_check_instance.is_active = True
ping_check_instance.save()
dm.refresh_from_db()
self.assertEqual(dm.status, 'ok')
self.assertEqual(dm.status, 'unknown')

def test_saving_non_critical_check(self):
Check = load_model('check', 'Check')
Expand All @@ -621,7 +621,7 @@ def test_saving_non_critical_check(self):
non_critical_check.is_active = False
non_critical_check.save()
self.assertEqual(
handler.call_count, 0, "Signal should not be fired for non-critical check"
handler.call_count, 0, 'Signal should not be fired for non-critical check'
)
dm.refresh_from_db()
self.assertEqual(dm.status, 'ok')
Expand Down

0 comments on commit b450635

Please sign in to comment.