test_sdb.py 1021 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # -*- coding: utf-8 -*-
  2. '''
  3. :codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
  4. '''
  5. # Import Python Libs
  6. from __future__ import absolute_import, unicode_literals, print_function
  7. # Import Salt Testing Libs
  8. from tests.support.mixins import LoaderModuleMockMixin
  9. from tests.support.unit import TestCase
  10. # Import Salt Libs
  11. import salt.modules.sdb as sdb
  12. class SdbTestCase(TestCase, LoaderModuleMockMixin):
  13. '''
  14. Test cases for salt.modules.sdb
  15. '''
  16. def setup_loader_modules(self):
  17. return {sdb: {}}
  18. # 'get' function tests: 1
  19. def test_get(self):
  20. '''
  21. Test if it gets a value from a db, using a uri in the form of
  22. sdb://<profile>/<key>
  23. '''
  24. self.assertEqual(sdb.get('sdb://salt/foo'), 'sdb://salt/foo')
  25. # 'set_' function tests: 1
  26. def test_set(self):
  27. '''
  28. Test if it sets a value from a db, using a uri in the form of
  29. sdb://<profile>/<key>
  30. '''
  31. self.assertFalse(sdb.set_('sdb://mymemcached/foo', 'bar'))