/test/unmountshare_tester.py

https://github.com/hpe-storage/python-hpedockerplugin
Python | 70 lines | 32 code | 15 blank | 23 comment | 0 complexity | 7a27a4f2caed0f0c021eff55c0cb1aa8 MD5 | raw file
  1. import copy
  2. import test.fake_3par_data as data
  3. import test.hpe_docker_unit_test as hpedockerunittest
  4. class UnmountShareUnitTest(hpedockerunittest.HpeDockerUnitTestExecutor):
  5. def __init__(self):
  6. self._backend_name = None
  7. self._share = copy.deepcopy(data.etcd_mounted_share)
  8. def _get_plugin_api(self):
  9. return 'volumedriver_unmount'
  10. def get_request_params(self):
  11. return {"Name": 'GoodShare',
  12. "ID": "Fake-Mount-ID"}
  13. def setup_mock_objects(self):
  14. def _setup_mock_3parclient():
  15. self.setup_mock_3parclient()
  16. def _setup_mock_etcd():
  17. mock_share_etcd = self.mock_objects['mock_share_etcd']
  18. mock_share_etcd.get_share.return_value = self._share
  19. # Allow child class to make changes
  20. self.setup_mock_etcd()
  21. # def _setup_mock_fileutil():
  22. # mock_fileutil = self.mock_objects['mock_fileutil']
  23. # mock_fileutil.mkdir_for_mounting.return_value = '/tmp'
  24. # # Let the flow create filesystem
  25. # mock_fileutil.has_filesystem.return_value = False
  26. # # Allow child class to make changes
  27. # self.setup_mock_fileutil()
  28. _setup_mock_3parclient()
  29. _setup_mock_etcd()
  30. # _setup_mock_fileutil()
  31. def setup_mock_3parclient(self):
  32. pass
  33. def setup_mock_etcd(self):
  34. pass
  35. def setup_mock_fileutil(self):
  36. pass
  37. class TestUnmountNfsShare(UnmountShareUnitTest):
  38. def __init__(self, **kwargs):
  39. super(type(self), self).__init__(**kwargs)
  40. # def setup_mock_3parclient(self):
  41. # mock_client = self.mock_objects['mock_3parclient']
  42. def check_response(self, resp):
  43. pass
  44. # mnt_point = '/opt/hpe/data/hpedocker-GoodShare'
  45. # dev_name = '192.168.98.41:/DockerFpg_2/DockerVfs_2/GoodShare'
  46. # expected = {
  47. # 'Mountpoint': mnt_point,
  48. # 'Err': '',
  49. # 'Name': 'GoodShare',
  50. # 'Devicename': dev_name}
  51. # expected_keys = ["Mountpoint", "Name", "Err", "Devicename"]
  52. # for key in expected_keys:
  53. # self._test_case.assertIn(key, resp)
  54. #
  55. # self._test_case.assertEqual(resp, expected)