Upload via GUI (340 Dateien)
This commit is contained in:
@@ -107,7 +107,7 @@ try {
|
|||||||
// Verwaltungsseite: Installationen sehen, sperren, entsperren, löschen
|
// Verwaltungsseite: Installationen sehen, sperren, entsperren, löschen
|
||||||
$jar = $work . '/admin.jar';
|
$jar = $work . '/admin.jar';
|
||||||
$web = function (string $method, array $form = []) use ($relayPort, $jar): string {
|
$web = function (string $method, array $form = []) use ($relayPort, $jar): string {
|
||||||
$ch = curl_init("http://127.0.0.1:$relayPort/admin.php");
|
$ch = curl_init("http://127.0.0.1:$relayPort/admin.php?tab=push");
|
||||||
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_COOKIEJAR => $jar, CURLOPT_COOKIEFILE => $jar, CURLOPT_TIMEOUT => 20]);
|
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_COOKIEJAR => $jar, CURLOPT_COOKIEFILE => $jar, CURLOPT_TIMEOUT => 20]);
|
||||||
if ($method === 'POST') curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($form)]);
|
if ($method === 'POST') curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($form)]);
|
||||||
$o = curl_exec($ch);
|
$o = curl_exec($ch);
|
||||||
@@ -119,7 +119,7 @@ try {
|
|||||||
$page = $web('GET');
|
$page = $web('GET');
|
||||||
preg_match('/name="csrf" value="([a-f0-9]+)"/', $page, $cm);
|
preg_match('/name="csrf" value="([a-f0-9]+)"/', $page, $cm);
|
||||||
$csrf = $cm[1] ?? '';
|
$csrf = $cm[1] ?? '';
|
||||||
$check(str_contains($page, 'Push-Dienst (Android-App)') && str_contains($page, 'support.firma.de') && !str_contains($page, '<script>') && str_contains($page, 'Firebase-Dienstkonto eingebaut'), 'Verwaltung listet die Installationen (Name bereinigt) und zeigt den Dienstkonto-Status');
|
$check(str_contains($page, 'Zentraler Push-Dienst der Android-App') && str_contains($page, 'support.firma.de') && !str_contains($page, '<script>') && str_contains($page, 'Firebase-Dienstkonto eingebaut'), 'Verwaltung listet die Installationen (Name bereinigt) und zeigt den Dienstkonto-Status');
|
||||||
$web('POST', ['action' => 'push_block', 'csrf' => $csrf, 'id' => $id]);
|
$web('POST', ['action' => 'push_block', 'csrf' => $csrf, 'id' => $id]);
|
||||||
$check($post($base)['code'] === 403, 'In der Verwaltung gesperrt: Senden wird abgelehnt');
|
$check($post($base)['code'] === 403, 'In der Verwaltung gesperrt: Senden wird abgelehnt');
|
||||||
$web('POST', ['action' => 'push_unblock', 'csrf' => $csrf, 'id' => $id]);
|
$web('POST', ['action' => 'push_unblock', 'csrf' => $csrf, 'id' => $id]);
|
||||||
|
|||||||
@@ -170,13 +170,9 @@ try {
|
|||||||
$after = browser_request($port, 'GET', '/staff/departments.php', $cookies);
|
$after = browser_request($port, 'GET', '/staff/departments.php', $cookies);
|
||||||
if (stripos($after[1], 'kann nicht gelöscht werden') === false) throw new RuntimeException('Nach dem Löschversuch fehlt die verständliche Meldung.');
|
if (stripos($after[1], 'kann nicht gelöscht werden') === false) throw new RuntimeException('Nach dem Löschversuch fehlt die verständliche Meldung.');
|
||||||
}
|
}
|
||||||
// App-Download: Seite für alle Mitarbeiter, Datei nur mit Anmeldung
|
// App-Download: Die Apps kommen von der Plugin-Seite (hier ohne erreichbaren Katalog): Seite lädt, Download liefert 404, ohne Anmeldung 302
|
||||||
assert_page(browser_request($port, 'GET', '/staff/apps.php', $cookies), 'Android-App herunterladen');
|
assert_page(browser_request($port, 'GET', '/staff/apps.php', $cookies), 'Apps für Mitarbeiter');
|
||||||
$dl = browser_request($port, 'GET', '/staff/app_download.php?platform=android', $cookies);
|
if (browser_request($port, 'GET', '/staff/app_download.php?platform=android', $cookies)[0] !== 404) throw new RuntimeException('Ohne veröffentlichte App sollte der Download 404 liefern.');
|
||||||
if ($dl[0] !== 200 || $dl[1] !== $smokeApk) throw new RuntimeException('App-Download liefert nicht die hinterlegte Datei.');
|
|
||||||
if (stripos(implode("
|
|
||||||
", $dl[2]), 'application/vnd.android.package-archive') === false) throw new RuntimeException('App-Download hat den falschen Dateityp.');
|
|
||||||
if (browser_request($port, 'GET', '/staff/app_download.php?platform=windows', $cookies)[0] !== 404) throw new RuntimeException('Nicht hinterlegte App sollte 404 liefern.');
|
|
||||||
if (browser_request($port, 'GET', '/staff/app_download.php?platform=../../config/config', $cookies)[0] !== 404) throw new RuntimeException('Unbekannte Plattform sollte 404 liefern.');
|
if (browser_request($port, 'GET', '/staff/app_download.php?platform=../../config/config', $cookies)[0] !== 404) throw new RuntimeException('Unbekannte Plattform sollte 404 liefern.');
|
||||||
$noCookies = [];
|
$noCookies = [];
|
||||||
$anon = browser_request($port, 'GET', '/staff/app_download.php?platform=android', $noCookies);
|
$anon = browser_request($port, 'GET', '/staff/app_download.php?platform=android', $noCookies);
|
||||||
|
|||||||
Reference in New Issue
Block a user