do not set description to empty value if not passed as parameter as it is optionally; fixes #890

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2020-10-14 14:25:06 +02:00
parent 3a47b2050e
commit 3dcbbb9e7b
2 changed files with 21 additions and 1 deletions

View File

@@ -307,7 +307,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
// paramters
$password = $this->getParam('mysql_password', true, '');
$databasedescription = $this->getParam('description', true, '');
$databasedescription = $this->getParam('description', true, $result['description']);
// validation
$password = \Froxlor\Validate\Validate::validate($password, 'password', '', '', array(), true);

View File

@@ -136,6 +136,26 @@ class MysqlsTest extends TestCase
}
}
/**
*
* @depends testCustomerMysqlsAdd
*/
public function testAdminMysqlsUpdatePwdOnly()
{
global $admin_userdata;
$newPwd = \Froxlor\System\Crypt::generatePassword();
$data = [
'dbname' => 'test1sql1',
'mysql_password' => $newPwd,
'loginname' => 'test1'
];
$json_result = Mysqls::getLocal($admin_userdata, $data)->update();
$result = json_decode($json_result, true)['data'];
$this->assertEquals('testdb-upd', $result['description']);
}
/**
*
* @depends testCustomerMysqlsAdd