"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "manila/tests/share/drivers/test_helpers.py" between
manila-8.1.2.tar.gz and manila-8.1.3.tar.gz

About: OpenStack Manila provides “Shared Filesystems as a service”.
The "Stein" series (maintained release).

test_helpers.py  (manila-8.1.2):test_helpers.py  (manila-8.1.3)
skipping to change at line 678 skipping to change at line 678
self.mock_object(self._helper, '_get_allow_hosts', self.mock_object(self._helper, '_get_allow_hosts',
mock.Mock(return_value=allowed_hosts)) mock.Mock(return_value=allowed_hosts))
self._helper.disable_access_for_maintenance( self._helper.disable_access_for_maintenance(
self.server_details, self.share_name) self.server_details, self.share_name)
self._helper._get_allow_hosts.assert_called_once_with( self._helper._get_allow_hosts.assert_called_once_with(
self.server_details, self.share_name) self.server_details, self.share_name)
self._helper._set_allow_hosts.assert_called_once_with( self._helper._set_allow_hosts.assert_called_once_with(
self.server_details, [], self.share_name) self.server_details, [], self.share_name)
kickoff_user_cmd = ['sudo', 'smbstatus', '-S']
self._helper._ssh_exec.assert_any_call(
self.server_details, kickoff_user_cmd)
valid_cmd = ['echo', "'test test2'", '|', 'sudo', 'tee', valid_cmd = ['echo', "'test test2'", '|', 'sudo', 'tee',
maintenance_path] maintenance_path]
self._helper._ssh_exec.assert_called_once_with( self._helper._ssh_exec.assert_any_call(
self.server_details, valid_cmd) self.server_details, valid_cmd)
def test__kick_out_users_success(self):
smbstatus_return = """Service pid machine Connected at
-------------------------------------------------------
fake_share_name 1001 fake_machine1 Thu Sep 14 14:59:07 2017
fake_share_name 1002 fake_machine2 Thu Sep 14 14:59:07 2017
"""
self.mock_object(self._helper, '_ssh_exec', mock.Mock(
side_effect=[(smbstatus_return, "fake_stderr"), ("fake", "fake")]))
self._helper._kick_out_users(self.server_details, self.share_name)
self._helper._ssh_exec.assert_any_call(
self.server_details, ['sudo', 'smbstatus', '-S'])
self._helper._ssh_exec.assert_any_call(
self.server_details, ["sudo", "kill", "-15", "1001", "1002"])
def test__kick_out_users_failed(self):
smbstatus_return = """Service pid machine Connected at
-------------------------------------------------------
fake line
"""
self.mock_object(self._helper, '_ssh_exec', mock.Mock(
return_value=(smbstatus_return, "fake_stderr")))
self.assertRaises(exception.ShareBackendException,
self._helper._kick_out_users, self.server_details,
self.share_name)
def test_restore_access_after_maintenance(self): def test_restore_access_after_maintenance(self):
fake_maintenance_path = "test.path" fake_maintenance_path = "test.path"
self.mock_object(self._helper, '_set_allow_hosts') self.mock_object(self._helper, '_set_allow_hosts')
self.mock_object(self._helper, '_get_maintenance_file_path', self.mock_object(self._helper, '_get_maintenance_file_path',
mock.Mock(return_value=fake_maintenance_path)) mock.Mock(return_value=fake_maintenance_path))
self.mock_object(self._helper, '_ssh_exec', self.mock_object(self._helper, '_ssh_exec',
mock.Mock(side_effect=[("fake fake2", 0), "fake"])) mock.Mock(side_effect=[("fake fake2", 0), "fake"]))
self._helper.restore_access_after_maintenance( self._helper.restore_access_after_maintenance(
self.server_details, self.share_name) self.server_details, self.share_name)
 End of changes. 3 change blocks. 
1 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)