1
0
Fork 0

Adding upstream version 2.3~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:53:48 +01:00
parent 02717bbc1e
commit a8d8344f07
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
37 changed files with 1946 additions and 407 deletions

View file

@ -36,6 +36,26 @@ class Test(unittest.TestCase):
srv.kill()
self.assertEqual(srv.info(), {'avahi wake up timer': 'None', 'service types': [], 'services': {}})
def test__txt2dict(self):
txt = [
list('NqN=Starfleet'.encode('utf-8')),
list('p=tcp'.encode('utf-8')),
]
self.assertEqual(avahi._txt2dict(txt), {'nqn': 'Starfleet', 'p': 'tcp'})
txt = [
list('Nqn=Starfleet'.encode('utf-8')),
list('p='.encode('utf-8')), # Try with a missing value for p
list('blah'.encode('utf-8')), # Missing '='
list('='.encode('utf-8')), # Just '='
]
self.assertEqual(avahi._txt2dict(txt), {'nqn': 'Starfleet', 'p': ''})
txt = [
[1000, ord('='), 123456], # Try with non printable characters
]
self.assertEqual(avahi._txt2dict(txt), {})
if __name__ == '__main__':
unittest.main()