@@ -153,39 +153,29 @@ test all => sub {
153
153
};
154
154
155
155
subtest ' send_email_verification' => sub {
156
+ $email -> send_email_verification(
157
+ email => ' user@example.com' ,
158
+ verification_link => " $server /verify-email" ,
159
+ editor => $user1 ,
160
+ );
156
161
157
- $email -> send_email_verification(
158
- email => ' user@example.com' ,
159
- verification_link => " $server /verify-email" ,
160
- ip => ' 127.0.0.1' ,
161
- editor => $user1 ,
162
- );
163
-
164
- is($email -> transport-> delivery_count, 1);
165
- my $delivery = $email -> transport-> shift_deliveries;
166
- is($delivery -> {envelope }-> {from }, ' noreply@musicbrainz.org' , " Envelope from is noreply@..." );
167
- my $e = $delivery -> {email };
168
- $email -> transport-> clear_deliveries;
169
- is($e -> get_header(' From' ), ' MusicBrainz Server <noreply@musicbrainz.org>' , ' From is noreply@...' );
170
- is($e -> get_header(' To' ), ' user@example.com' , ' To is user@example.com' );
171
- is($e -> get_header(' Subject' ), ' Please verify your email address' , ' Subject is Please verify your email address' );
172
- like($e -> get_header(' Message-Id' ), qr { <verify-email-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}@.*>} , ' Message-Id has right format' );
173
- compare_body($e -> object-> body_str,
174
- " Hello Editor 1,\n " .
175
- " \n " .
176
- " This is a verification email for your MusicBrainz account. Please click\n " .
177
- " on the link below to verify your email address:\n " .
178
- " \n " .
179
- " $server /verify-email\n " .
180
- " \n " .
181
- " If clicking the link above doesn't work, please copy and paste the URL in a\n " .
182
- " new browser window instead.\n " .
183
- " This email was triggered by a request from the IP address [127.0.0.1].\n " .
184
- " \n " .
185
- " Thanks for using MusicBrainz!\n " .
186
- " \n " .
187
- " -- The MusicBrainz Team\n " );
188
-
162
+ my $mail_service_req = shift (@mail_service_reqs );
163
+ my $mail_service_req_content = decode_json($mail_service_req -> content);
164
+ is($mail_service_req -> method, ' POST' , ' mail service request method is POST' );
165
+ is($mail_service_req -> uri, ' http://localhost:3000/send_single' , ' mail service request uri is send_single' );
166
+ is($mail_service_req -> header(' Accept' ), ' application/json' , ' client accepts application/json' );
167
+ is($mail_service_req -> header(' Content-Type' ), ' application/json' , ' mail service content-type is application/json' );
168
+ cmp_deeply($mail_service_req_content , {
169
+ template_id => ' verify-email' ,
170
+ to => ' user@example.com' ,
171
+ from => ' MusicBrainz Server <noreply@musicbrainz.org>' ,
172
+ reply_to => ' MusicBrainz Server <noreply@musicbrainz.org>' ,
173
+ message_id => re(qr / ^<verify-email-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\@ localhost>$ / ),
174
+ params => {
175
+ verification_url => " $server /verify-email" ,
176
+ to_name => ' Editor 1' ,
177
+ },
178
+ }, ' mail service request content is correct' );
189
179
};
190
180
191
181
subtest ' send_lost_username' => sub {
0 commit comments