-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsonos_unittest.py
40 lines (35 loc) · 1.37 KB
/
sonos_unittest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/python
import unittest
import sonos
class TestCoreMethods(unittest.TestCase):
def test_fuzzy(self):
self.assertEqual(sonos.fuzz('80:2A:A8:D1:07:95'),
[
'80:2A:A8:D1:07:94',
'80:2A:A8:D1:07:96',
'80:2A:A8:D1:06:95',
'80:2A:A8:D1:07:95',
'80:2A:A8:D1:08:95',
'80:2A:A8:D0:07:95',
'80:2A:A8:D2:07:95',
])
def test_fuzzy_boundaries(self):
"""
If we hit a boundary, we wrap around so:
FF + 1 == 00
00 - 1 == FF
I have no idea if this is actually what network manufacturers do
in this case. I assume it'll break for somebody and they'll tell me.
"""
self.assertEqual(sonos.fuzz('80:2A:A8:00:7F:FF'),
[
'80:2A:A8:00:7F:FE',
'80:2A:A8:00:7F:00',
'80:2A:A8:00:7E:FF',
'80:2A:A8:00:7F:FF',
'80:2A:A8:00:80:FF',
'80:2A:A8:FF:7F:FF',
'80:2A:A8:01:7F:FF',
])
if __name__ == '__main__':
unittest.main()