diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-22 08:45:26 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-22 08:45:26 +0200 |
commit | 9101207449e1770024a635f34a48d8246425d94e (patch) | |
tree | 2d709624d3c7ccb9ac60c8987d3059ca930c7464 /t/02-registration.t | |
parent | 2b54ecf7a91aa7cda22c4fd983791433387566c2 (diff) |
Add test for account (un)deletion
Diffstat (limited to 't/02-registration.t')
-rw-r--r-- | t/02-registration.t | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/t/02-registration.t b/t/02-registration.t index efa0b8a..85355df 100644 --- a/t/02-registration.t +++ b/t/02-registration.t @@ -12,8 +12,8 @@ require "$FindBin::Bin/../index.pl"; my $t = Test::Mojo->new('Travelynx'); -if (not $t->app->config->{db}) { - plan(skip_all => 'No database configured'); +if ( not $t->app->config->{db} ) { + plan( skip_all => 'No database configured' ); } $t->app->pg->db->query('drop schema if exists travelynx_test_02 cascade'); @@ -90,5 +90,31 @@ $t->post_ok( ); $t->status_is(302)->header_is( location => '/' ); +# Request deletion + +$csrf_token = $t->ua->get('/account')->res->dom->at('input[name=csrf_token]') + ->attr('value'); + +$t->post_ok( + '/delete' => form => { + action => 'delete', + csrf_token => $csrf_token, + password => 'foofoofoo', + } +); +$t->status_is(302)->header_is( location => '/account' ); +$t->get_ok('/account'); +$t->status_is(200)->content_like(qr{wird gelöscht}); + +$t->post_ok( + '/delete' => form => { + action => 'undelete', + csrf_token => $csrf_token, + } +); +$t->status_is(302)->header_is( location => '/account' ); +$t->get_ok('/account'); +$t->status_is(200)->content_unlike(qr{wird gelöscht}); + $t->app->pg->db->query('drop schema travelynx_test_02 cascade'); done_testing(); |