OSDN Git Service

add email change related test
authorhylom <hylom@users.sourceforge.jp>
Wed, 14 Nov 2018 12:47:56 +0000 (21:47 +0900)
committerhylom <hylom@users.sourceforge.jp>
Wed, 14 Nov 2018 12:47:56 +0000 (21:47 +0900)
src/newslash_web/t/api/user.t

index 3b4c548..95734ca 100644 (file)
@@ -104,6 +104,16 @@ subtest 'update email' => sub {
 
     my $new_address = 'foobarhogehoge@example.com';
 
+    # send invalid address
+    $t->post_ok('/api/v1/user' => {Accept => '*/*'} => json => { type => "email",
+                                                                 address => "foobarhogehoge" })
+      ->status_is(400)
+      ->content_type_like(qr|application/json|)
+      ->json_is('/error', 1)
+      ->json_is('/message', "INVALID_ADDRESS");
+    diag dumper $t->tx->res->json if !$t->success;
+
+    # send
     $t->post_ok('/api/v1/user' => {Accept => '*/*'} => json => { type => "email",
                                                                  address => $new_address })
       ->status_is(200)