def test_modify_raise(self): param = Object() param.mode = Mode.Disabled self._init_filer(get_response=param) with self.assertRaises(exception.CTERAException) as error: ftp.FTP(self._filer).modify() self.assertEqual('FTP must be enabled in order to modify its configuration', error.exception.message)
def test_modify_success(self): self._init_filer(get_response=TestEdgeFTP._get_ftp_configuration_response()) ftp.FTP(self._filer).modify(True, 5, 'folder', 'Welcome to Gotham City FTP.', 10, True) self._filer.get.assert_called_once_with('/config/fileservices/ftp') self._filer.put.assert_called_once_with('/config/fileservices/ftp', mock.ANY) expected_param = TestEdgeFTP._get_ftp_configuration_response(True, 5, 'folder', 'Welcome to Gotham City FTP.', 10, True) actual_param = self._filer.put.call_args[0][1] self._assert_equal_objects(actual_param, expected_param)
def test_ftp_is_not_disabled(self): self._init_filer(get_response=Mode.Enabled) ret = ftp.FTP(self._filer).is_disabled() self._filer.get.assert_called_once_with('/config/fileservices/ftp/mode') self.assertEqual(ret, False)
def test_disable_ftp(self): self._init_filer() ftp.FTP(self._filer).disable() self._filer.put.assert_called_once_with('/config/fileservices/ftp/mode', Mode.Disabled)
def test_get_configuration(self): self._init_filer(get_response=TestEdgeFTP._get_ftp_configuration_response()) ret = ftp.FTP(self._filer).get_configuration() self._filer.get.assert_called_once_with('/config/fileservices/ftp') self._assert_equal_objects(ret, TestEdgeFTP._get_ftp_configuration_response())