Skip to content

Commit

Permalink
[req-changes] Reverted deletion of test_200_none
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Nov 28, 2023
1 parent 1fe816f commit b0dfad1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions openwisp_monitoring/device/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,27 @@ def test_400(self):
)
self.assertEqual(r.status_code, 400)

def test_200_none(self):
o = self._create_org()
d = self._create_device(organization=o)
data = {'type': 'DeviceMonitoring', 'interfaces': []}
with self.assertNumQueries(4):
r = self._post_data(d.id, d.key, data)
self.assertEqual(r.status_code, 200)
# Add 1 for general metric and chart
self.assertEqual(self.metric_queryset.count(), 0)
self.assertEqual(self.chart_queryset.count(), 0)
data = {'type': 'DeviceMonitoring'}
with self.assertNumQueries(2):
r = self._post_data(d.id, d.key, data)
self.assertEqual(r.status_code, 200)
# Add 1 for general metric and chart
self.assertEqual(self.metric_queryset.count(), 0)
self.assertEqual(self.chart_queryset.count(), 0)
d.delete()
r = self._post_data(d.id, d.key, data)
self.assertEqual(r.status_code, 404)

def test_200_create(self):
self.create_test_data(no_resources=True)

Expand Down

0 comments on commit b0dfad1

Please sign in to comment.