Example #1
0
 def test_modify_smb_disabled_raise(self):
     param = Object()
     param.mode = Mode.Disabled
     self._init_filer(get_response=param)
     with self.assertRaises(exception.CTERAException) as error:
         smb.SMB(self._filer).modify(CIFSPacketSigning.Required)
     self.assertEqual('SMB must be enabled in order to modify its configuration', error.exception.message)
Example #2
0
 def test_modify_success(self):
     self._init_filer(get_response=TestEdgeSMB._get_cifs_configuration_response())
     smb.SMB(self._filer).modify(CIFSPacketSigning.Required, 20, True, False, False)
     self._filer.get.assert_called_once_with('/config/fileservices/cifs')
     self._filer.put.assert_called_once_with('/config/fileservices/cifs', mock.ANY)
     expected_param = TestEdgeSMB._get_cifs_configuration_response(CIFSPacketSigning.Required, 20, True, False, False)
     actual_param = self._filer.put.call_args[0][1]
     self._assert_equal_objects(actual_param, expected_param)
Example #3
0
 def test_modify_raise(self):
     self._init_filer(get_response=TestEdgeSMB._get_cifs_configuration_response())
     self._filer.put = mock.MagicMock(side_effect=exception.CTERAException())
     with self.assertRaises(exception.CTERAException) as error:
         smb.SMB(self._filer).modify(CIFSPacketSigning.Required, 20, True, False, False)
     self._filer.get.assert_called_once_with('/config/fileservices/cifs')
     self._filer.put.assert_called_once_with('/config/fileservices/cifs', mock.ANY)
     expected_param = TestEdgeSMB._get_cifs_configuration_response(CIFSPacketSigning.Required, 20, True, False, False)
     actual_param = self._filer.put.call_args[0][1]
     self._assert_equal_objects(actual_param, expected_param)
     self.assertEqual('Failed to update SMB configuration.', error.exception.message)
Example #4
0
 def test_set_packet_signing_raise_error(self):
     expected_exception = exception.CTERAException()
     self._filer.put = mock.MagicMock(side_effect=expected_exception)
     with self.assertRaises(exception.CTERAException) as error:
         smb.SMB(self._filer).set_packet_signing(CIFSPacketSigning.Disabled)
     self.assertEqual('Invalid packet signing co', error.exception.message)
Example #5
0
 def test_get_configuration(self):
     self._init_filer(get_response=TestEdgeSMB._get_cifs_configuration_response())
     ret = smb.SMB(self._filer).get_configuration()
     self._filer.get.assert_called_once_with('/config/fileservices/cifs')
     self._assert_equal_objects(ret, TestEdgeSMB._get_configuration_response())
Example #6
0
 def test_set_packet_signing_raise_input_error(self):
     with self.assertRaises(exception.InputError) as error:
         smb.SMB(self._filer).set_packet_signing('Invalid argument')
     self.assertEqual('Invalid packet signing option', error.exception.message)
Example #7
0
 def test_required_packet_signing(self):
     self._init_filer()
     smb.SMB(self._filer).set_packet_signing(CIFSPacketSigning.Required)
     self._filer.put.assert_called_once_with('/config/fileservices/cifs/packetSigning', CIFSPacketSigning.Required)
Example #8
0
 def test_packet_signing_if_client_agrees(self):
     self._init_filer()
     smb.SMB(self._filer).set_packet_signing(CIFSPacketSigning.IfClientAgrees)
     self._filer.put.assert_called_once_with('/config/fileservices/cifs/packetSigning', CIFSPacketSigning.IfClientAgrees)
Example #9
0
 def test_disable_abe(self):
     self._init_filer()
     smb.SMB(self._filer).disable_abe()
     self._filer.put.assert_called_once_with('/config/fileservices/cifs/hideUnreadable', False)
Example #10
0
 def test_enable_smb(self):
     self._init_filer()
     smb.SMB(self._filer).enable()
     self._filer.put.assert_called_once_with('/config/fileservices/cifs/mode', Mode.Enabled)