Skip to content

Commit

Permalink
[feature] Updated label for wireless interface clients
Browse files Browse the repository at this point in the history
"Access Point MAC address" for wireless interface in "station" mode,
"Associated client MAC address" otherwise.
  • Loading branch information
pandafy committed Sep 20, 2023
1 parent fa13115 commit ede4f0e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ <h2>{% trans 'Interface status' %}: {{ interface.name }}</h2>
<thead>
<tr>
<th class="mac">
{% if interface.wireless.mode == 'station' %}
{% trans 'Access Point' %}
{% else %}
{% trans 'Associated client' %}
{% endif %}
{% trans 'MAC address' %}
</th>
{% if MAC_VENDOR_DETECTION %}
Expand Down
21 changes: 21 additions & 0 deletions openwisp_monitoring/device/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ def test_status_data(self):
],
}
)
data['interfaces'].append(deepcopy(data['interfaces'][0]))
data['interfaces'][2].update(
{
'name': 'wlan2',
'mac': '44:d1:fa:4b:38:45',
}
)
data['interfaces'][2]['wireless']['mode'] = 'station'
self._post_data(d.id, d.key, data)
url = reverse('admin:config_device_change', args=[d.pk])
r = self.client.get(url)
Expand All @@ -153,6 +161,19 @@ def test_status_data(self):
self.assertContains(r, '44:D1:FA:4B:00:02')
with self.subTest('Neighbor IP is shown'):
self.assertContains(r, 'fe80::9683:c4ff:fe02:c2bf')
with self.subTest('Wireless client table header is shown'):
self.assertContains(
r,
('<th class="mac">\n\n' 'Associated client\n\nMAC address\n\n' '</th>'),
html=True,
count=2,
)
self.assertContains(
r,
('<th class="mac">\n\n' 'Access Point\n\nMAC address\n\n' '</th>'),
html=True,
count=1,
)

def test_status_data_contains_wifi_version(self):
data = self._data()
Expand Down

0 comments on commit ede4f0e

Please sign in to comment.