Skip to content

Commit

Permalink
test: adding a test that check if preferences edits made by an user a…
Browse files Browse the repository at this point in the history
…re saved (#8766)
  • Loading branch information
albatrousse authored Aug 8, 2023
1 parent 2eab21e commit 0af2f09
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/integration/modify_user.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/perl -w

use ProductOpener::PerlStandards;

use Test::More;
use ProductOpener::APITest qw/:all/;
use ProductOpener::Test qw/:all/;
use ProductOpener::TestDefaults qw/:all/;

remove_all_users();
wait_application_ready();
my $ua = new_client();

my %create_user_args = (%default_user_form, (email => 'bob@test.com'));
create_user($ua, \%create_user_args);

#editing the user preferences
my %edit_form = (
email => 'notbob@test.com',
name => 'NotTest',
userid => 'tests',
pro_checkbox => 1,
action => "process",
type => "edit"

);
my $url_edit = construct_test_url("/cgi/user.pl", "world");
my $response_edit = $ua->post($url_edit, \%edit_form);

#checking if the changes were saved
my $url_check = construct_test_url("/cgi/user.pl?type=edit&userid=tests", "world");
my $response_check = $ua->get($url_check);
like($response_check->content, qr/notbob\@test\.com/, "the new email has been well saved");
like($response_check->content, qr/NotTest/, "the new name has been well saved");

done_testing();

0 comments on commit 0af2f09

Please sign in to comment.