test_avahi_announce.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # coding: utf-8
  2. # Python libs
  3. from __future__ import absolute_import
  4. # Salt testing libs
  5. from tests.support.unit import TestCase
  6. from tests.support.mixins import LoaderModuleMockMixin
  7. # Salt libs
  8. import salt.beacons.avahi_announce as avahi_announce
  9. class AvahiAnnounceBeaconTestCase(TestCase, LoaderModuleMockMixin):
  10. '''
  11. Test case for salt.beacons.avahi_announce
  12. '''
  13. def setup_loader_modules(self):
  14. return {
  15. avahi_announce: {
  16. 'last_state': {},
  17. 'last_state_extra': {'no_devices': False}
  18. }
  19. }
  20. def test_non_list_config(self):
  21. config = {}
  22. ret = avahi_announce.validate(config)
  23. self.assertEqual(ret, (False, 'Configuration for avahi_announce'
  24. ' beacon must be a list.'))
  25. def test_empty_config(self):
  26. config = [{}]
  27. ret = avahi_announce.validate(config)
  28. self.assertEqual(ret, (False, 'Configuration for avahi_announce'
  29. ' beacon must contain servicetype, port'
  30. ' and txt items.'))