Make API testable & move PhotoAlbum tests to new destination

This commit is contained in:
Philipp
2021-11-12 21:08:36 +01:00
parent a0c5c91886
commit e477cf215d
10 changed files with 174 additions and 96 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ class Delete extends BaseApi
// do several checks on input parameters
// we do not allow calls without photo id
if ($request['photo_id'] == null) {
if (empty($request['photo_id'])) {
throw new BadRequestException("no photo_id specified");
}
@@ -43,10 +43,10 @@ class Update extends BaseApi
]);
// we do not allow calls without album string
if ($request['album'] == "") {
if (empty($request['album'])) {
throw new BadRequestException("no albumname specified");
}
if ($request['album_new'] == "") {
if (empty($request['album_new'])) {
throw new BadRequestException("no new albumname specified");
}
// check if album is existing
+13 -1
View File
@@ -65,6 +65,18 @@ class Authentication
/** @var IManagePersonalConfigValues */
private $pConfig;
/**
* Sets the X-Account-Management-Status header
*
* mainly extracted to make it overridable for tests
*
* @param array $user_record
*/
protected function setXAccMgmtStatusHeader(array $user_record)
{
header('X-Account-Management-Status: active; name="' . $user_record['username'] . '"; id="' . $user_record['nickname'] . '"');
}
/**
* Authentication constructor.
*
@@ -314,7 +326,7 @@ class Authentication
$this->session->set('cid', $contact['id']);
}
header('X-Account-Management-Status: active; name="' . $user_record['username'] . '"; id="' . $user_record['nickname'] . '"');
$this->setXAccMgmtStatusHeader($user_record);
if ($login_initial || $login_refresh) {
$this->dba->update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $user_record['uid']]);