Skip to content

Commit

Permalink
[fix] Fixed changing status of link from LinkAdmin #154
Browse files Browse the repository at this point in the history
Closes #154
  • Loading branch information
pandafy committed Jun 6, 2023
1 parent 1a4562c commit ea1cea0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions openwisp_network_topology/integrations/device/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def link_get_queryset(cls, qs):
'organization__name',
'organization__is_active',
'status',
'properties',
'cost',
'cost_text',
'source__addresses',
Expand Down
22 changes: 22 additions & 0 deletions openwisp_network_topology/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,28 @@ def test_link_change_form(self):
self.assertNotContains(response, 'organization_id')
self.assertContains(response, link.topology.organization.name)

def test_link_update_status(self):
t = Topology.objects.first()
n1 = self._create_node(label='node1org1', topology=t)
n2 = self._create_node(label='node2org1', topology=t)
link = self._create_link(topology=t, source=n1, target=n2)
path = reverse('{0}_link_change'.format(self.prefix), args=[link.pk])
response = self.client.post(
path,
data={
'topology': str(t.pk),
'organization': str(t.organization_id),
'source': str(n1.id),
'target': str(n2.id),
'cost': '1.0',
'status': 'down',
},
follow=True,
)
self.assertEqual(response.status_code, 200)
link.refresh_from_db()
self.assertEqual(link.status, 'down')

def test_node_add(self):
path = reverse('{0}_node_add'.format(self.prefix))
response = self.client.get(path)
Expand Down

0 comments on commit ea1cea0

Please sign in to comment.