1
0

test_purefb.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # -*- coding: utf-8 -*-
  2. '''
  3. :codeauthor: :email:`Simon Dodsley <simon@purestorage.com>`
  4. '''
  5. # Import Python Libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. # Import Salt Testing Libs
  8. from tests.support.mixins import LoaderModuleMockMixin
  9. from tests.support.unit import TestCase
  10. from tests.support.mock import (
  11. patch,
  12. )
  13. # Import Salt Libs
  14. import salt.modules.purefb as purefb
  15. class PureFBTestCase(TestCase, LoaderModuleMockMixin):
  16. '''
  17. Test cases for salt.modules.purefb
  18. '''
  19. def setup_loader_modules(self):
  20. return {purefb: {}}
  21. def test_fs_create(self):
  22. '''
  23. Test for creation of a filesystem
  24. '''
  25. with patch.object(purefb, 'fs_create', return_value=True):
  26. self.assertEqual(purefb.fs_create('test'), True)
  27. def test_fs_delete(self):
  28. '''
  29. Test for deletion of a filesystem
  30. '''
  31. with patch.object(purefb, 'fs_delete', return_value=True):
  32. self.assertEqual(purefb.fs_delete('test'), True)
  33. def test_fs_eradicate(self):
  34. '''
  35. Test for eradication of a filesystem
  36. '''
  37. with patch.object(purefb, 'fs_eradicate', return_value=True):
  38. self.assertEqual(purefb.fs_eradicate('test'), True)
  39. def test_fs_extend(self):
  40. '''
  41. Test for size extention of a filesystem
  42. '''
  43. with patch.object(purefb, 'fs_extend', return_value=True):
  44. self.assertEqual(purefb.fs_extend('test', '33G'), True)
  45. def test_snap_create(self):
  46. '''
  47. Test for creation of a filesystem snapshot
  48. '''
  49. with patch.object(purefb, 'snap_create', return_value=True):
  50. self.assertEqual(purefb.snap_create('test', suffix='suffix'), True)
  51. def test_snap_delete(self):
  52. '''
  53. Test for deletion of a filesystem snapshot
  54. '''
  55. with patch.object(purefb, 'snap_delete', return_value=True):
  56. self.assertEqual(purefb.snap_delete('test', suffix='suffix'), True)
  57. def test_snap_eradicate(self):
  58. '''
  59. Test for eradication of a deleted filesystem snapshot
  60. '''
  61. with patch.object(purefb, 'snap_eradicate', return_value=True):
  62. self.assertEqual(purefb.snap_eradicate('test',
  63. suffix='suffix'), True)