++ informativa privacy aggiornata, valori dalle impostazioni
- Dati trattati attuali: email e telefono cifrati, link alla piantina, stato dell'invio, conferma email, log senza nomi. - Valori letti al momento: congregazione, conservazione del log, scadenza del link, download del PDF, server di posta, cifratura, durata della sessione, indirizzo/HTTPS, ruoli con i permessi veri, conteggi dei dati. - Servizi esterni: WhatsApp, posta, OpenStreetMap. - Dichiarato che backup ed export XML contengono i dati in chiaro. README e HANDOFF aggiornati. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
111
tests/Feature/PrivacyTest.php
Normal file
111
tests/Feature/PrivacyTest.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Proclamatore;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* L'informativa privacy legge i suoi valori dalle impostazioni e dai dati,
|
||||
* al momento: nessun numero scritto a mano.
|
||||
*/
|
||||
class PrivacyTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private User $admin;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->withoutVite();
|
||||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
|
||||
$this->admin = User::create(['name' => 'Admin', 'email' => 'admin@example.test', 'password' => 'password-di-prova']);
|
||||
$this->admin->assignRole('amministratore');
|
||||
}
|
||||
|
||||
public function test_i_valori_arrivano_dalle_impostazioni(): void
|
||||
{
|
||||
Setting::firstOrCreate([], ['congregazione_nome' => 'x'])->update([
|
||||
'congregazione_nome' => 'Congregazione Zisa',
|
||||
'audit_retention_days' => 400,
|
||||
'giorni_per_smarrito' => 95,
|
||||
'pdf_viewer_show_download' => false,
|
||||
]);
|
||||
|
||||
$this->actingAs($this->admin)->get(route('privacy'))
|
||||
->assertOk()
|
||||
->assertSee('Congregazione Zisa')
|
||||
->assertSee('conservato per')
|
||||
->assertSee('400 giorni')
|
||||
->assertSee('al massimo per 95 giorni')
|
||||
->assertSee('si può solo consultare, non scaricare');
|
||||
}
|
||||
|
||||
public function test_cambiare_un_impostazione_cambia_l_informativa(): void
|
||||
{
|
||||
$impostazioni = Setting::firstOrCreate([], ['congregazione_nome' => 'Prova']);
|
||||
$impostazioni->update(['pdf_viewer_show_download' => true, 'giorni_per_smarrito' => 60]);
|
||||
|
||||
$this->actingAs($this->admin)->get(route('privacy'))
|
||||
->assertSee('al massimo per 60 giorni')
|
||||
->assertSee('si può anche scaricare');
|
||||
}
|
||||
|
||||
public function test_i_ruoli_sono_quelli_veri_con_i_loro_permessi(): void
|
||||
{
|
||||
Setting::firstOrCreate([], ['congregazione_nome' => 'Prova']);
|
||||
|
||||
$this->actingAs($this->admin)->get(route('privacy'))
|
||||
->assertSee('Amministratore')
|
||||
->assertSee('Assistente')
|
||||
->assertSee('Operatore')
|
||||
->assertSee('assegnazione dei territori')
|
||||
->assertDontSee('Servitore di Territorio')
|
||||
->assertDontSee('Proclamatore Semplificato');
|
||||
}
|
||||
|
||||
public function test_conta_i_dati_conservati_senza_mostrarli(): void
|
||||
{
|
||||
Setting::firstOrCreate([], ['congregazione_nome' => 'Prova']);
|
||||
Proclamatore::create(['nome' => 'Mario', 'cognome' => 'Rossi', 'attivo' => true, 'email' => 'mario@example.test', 'telefono' => '3331234567']);
|
||||
Proclamatore::create(['nome' => 'Anna', 'cognome' => 'Verdi', 'attivo' => false]);
|
||||
|
||||
$this->actingAs($this->admin)->get(route('privacy'))
|
||||
->assertSee('2 proclamatori, di cui 1 attivi; 1 con email e 1 con numero di telefono')
|
||||
->assertDontSee('Rossi')
|
||||
->assertDontSee('mario@example.test');
|
||||
}
|
||||
|
||||
public function test_senza_posta_dice_che_non_si_inviano_email(): void
|
||||
{
|
||||
Setting::firstOrCreate([], ['congregazione_nome' => 'Prova']);
|
||||
config(['mail.default' => 'log']);
|
||||
|
||||
$this->actingAs($this->admin)->get(route('privacy'))
|
||||
->assertSee('nessun server di posta configurato');
|
||||
}
|
||||
|
||||
public function test_con_la_posta_dell_app_ne_mostra_il_server(): void
|
||||
{
|
||||
Setting::firstOrCreate([], ['congregazione_nome' => 'Prova'])
|
||||
->update(['mail_host' => 'smtp.example.test', 'mail_port' => 587]);
|
||||
|
||||
$this->actingAs($this->admin)->get(route('privacy'))
|
||||
->assertSee('smtp.example.test');
|
||||
}
|
||||
|
||||
public function test_e_riservata_all_amministratore(): void
|
||||
{
|
||||
Setting::firstOrCreate([], ['congregazione_nome' => 'Prova']);
|
||||
$operatore = User::create(['name' => 'Op', 'email' => 'op@example.test', 'password' => 'password-di-prova']);
|
||||
$operatore->assignRole('operatore');
|
||||
|
||||
$this->actingAs($operatore)->get(route('privacy'))->assertForbidden();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user