Lines 86-104
subtest 'auth.register helper' => sub {
Link Here
|
86 |
|
86 |
|
87 |
$schema->storage->txn_begin; |
87 |
$schema->storage->txn_begin; |
88 |
|
88 |
|
89 |
# Remove existing patrons |
89 |
# generate a random patron |
90 |
Koha::Patrons->delete; |
90 |
my $patron_to_delete = $builder->build_object({ class => 'Koha::Patrons' }); |
91 |
my $provider = $builder->build_object( { class => 'Koha::Auth::Identity::Providers', value => { matchpoint => 'email' } } ); |
91 |
my $userid = $patron_to_delete->userid; |
|
|
92 |
# delete patron |
93 |
$patron_to_delete->delete; |
94 |
|
95 |
my $provider = $builder->build_object( { class => 'Koha::Auth::Identity::Providers', value => { matchpoint => 'email' } } ); |
96 |
|
92 |
my $domain_with_register = $builder->build_object( |
97 |
my $domain_with_register = $builder->build_object( |
93 |
{ class => 'Koha::Auth::Identity::Provider::Domains', value => { identity_provider_id => $provider->id, domain => 'domain1.com', auto_register => 1 } } ); |
98 |
{ class => 'Koha::Auth::Identity::Provider::Domains', |
|
|
99 |
value => { identity_provider_id => $provider->id, domain => 'domain1.com', auto_register => 1 } |
100 |
} |
101 |
); |
102 |
|
94 |
my $domain_without_register = $builder->build_object( |
103 |
my $domain_without_register = $builder->build_object( |
95 |
{ class => 'Koha::Auth::Identity::Provider::Domains', value => { identity_provider_id => $provider->id, domain => 'domain2.com', auto_register => 0 } } ); |
104 |
{ class => 'Koha::Auth::Identity::Provider::Domains', |
|
|
105 |
value => { identity_provider_id => $provider->id, domain => 'domain2.com', auto_register => 0 } |
106 |
} |
107 |
); |
108 |
|
96 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
109 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
97 |
my $category = $builder->build_object( { class => 'Koha::Patron::Categories' } ); |
110 |
my $category = $builder->build_object( { class => 'Koha::Patron::Categories' } ); |
|
|
111 |
|
98 |
my $user_data = { |
112 |
my $user_data = { |
99 |
firstname => 'test', |
113 |
firstname => 'test', |
100 |
surname => 'test', |
114 |
surname => 'test', |
101 |
userid => 'id1', |
115 |
userid => $userid, |
102 |
branchcode => $library->branchcode, |
116 |
branchcode => $library->branchcode, |
103 |
categorycode => $category->categorycode |
117 |
categorycode => $category->categorycode |
104 |
}; |
118 |
}; |
Lines 110-115
subtest 'auth.register helper' => sub {
Link Here
|
110 |
|
124 |
|
111 |
$t->post_ok( '/register_user' => json => { data => $user_data, domain_id => $domain_without_register->identity_provider_domain_id, interface => 'opac' } )->status_is(401) |
125 |
$t->post_ok( '/register_user' => json => { data => $user_data, domain_id => $domain_without_register->identity_provider_domain_id, interface => 'opac' } )->status_is(401) |
112 |
->json_has( '/message', 'unauthorized' ); |
126 |
->json_has( '/message', 'unauthorized' ); |
|
|
127 |
|
113 |
$schema->storage->txn_rollback; |
128 |
$schema->storage->txn_rollback; |
114 |
}; |
129 |
}; |
115 |
|
130 |
|
Lines 118-125
subtest 'auth.session helper' => sub {
Link Here
|
118 |
|
133 |
|
119 |
$schema->storage->txn_begin; |
134 |
$schema->storage->txn_begin; |
120 |
|
135 |
|
121 |
# Remove existing patrons |
|
|
122 |
Koha::Patrons->delete; |
123 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
136 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
124 |
|
137 |
|
125 |
my $t = Test::Mojo->new; |
138 |
my $t = Test::Mojo->new; |
126 |
- |
|
|