From 906a57f66a882019831bd9f4e4bd47f5e51a3732 Mon Sep 17 00:00:00 2001 From: hylom Date: Fri, 31 Mar 2017 20:09:17 +0900 Subject: [PATCH] t: remove api.t --- src/newslash_web/t/api.t | 109 ----------------------------------------------- 1 file changed, 109 deletions(-) delete mode 100644 src/newslash_web/t/api.t diff --git a/src/newslash_web/t/api.t b/src/newslash_web/t/api.t deleted file mode 100644 index 2c77422e..00000000 --- a/src/newslash_web/t/api.t +++ /dev/null @@ -1,109 +0,0 @@ -# -*-Perl-*- -# destructive database-related tests -use Mojo::Base -strict; -use Mojo::Date; - -use Test::More; -use Test::Mojo; -use Data::Dumper; - -use POSIX qw(strftime); - -my $t = Test::Mojo->new('Newslash::Web'); - -if ($t->app->mode eq 'test') { - my $user = create_user($t->app, "test01", "foobar"); - ok($user, "create test user"); -} - -SKIP: { - skip "mode is not 'test'", 4 if ($t->app->mode ne 'test'); - - subtest 'submission post' => sub { - my $test_data = { - title => "テストタレコミ @ " . localtime, - introtext => "テスト本文\nてすとてすと", - action => 'post', - }; - $t->post_ok('/api/v1/submission' => {Accept => '*/*'} => json => $test_data) - ->status_is(200) - ->json_has('/id') - ->json_is('/type' => "submission"); - - # duplicated submission - $t->post_ok('/api/v1/submission' => {Accept => '*/*'} => json => $test_data) - ->status_is(409); - }; - - subtest 'comment post' => sub { - my $test_data = { - title => "テストコメント", - comment => "コメントテスト本文\nてすとてすと" . localtime, - discussion_id => 1, - stoid => 1, - action => 'post', - }; - $t->post_ok('/api/v1/comment' => {Accept => '*/*'} => json => $test_data) - ->status_is(200) - ->json_has('/id') - ->json_is('/type' => "comment"); - - }; - - subtest 'story post' => sub { - my $createtime = strftime('%FT%T', gmtime); - my $test_data = { - title => "テストストーリー", - createtime => $createtime, - author => "test01", - dept => "テストdept", - introtext => "テスト本文\nてすとてすと", - bodytext => "", - add_related => "", - url => "", - mediaurl => "", - mediatype => "", - email => "", - commentstatus => "enabled", - display => 1, - action => 'post', - }; - $t->post_ok('/api/v1/story' => {Accept => '*/*'} => json => $test_data) - ->status_is(200) - ->json_has('/id') - ->json_is('/type' => "story"); - }; - -} - -subtest 'submission preview' => sub { - my $test_data = { - title => "テストタレコミ @ " . localtime, - intro_text => "テスト本文\nてすとてすと", - action => 'preview', - }; - $t->post_ok('/api/v1/submission' => {Accept => '*/*'} => json => $test_data) - ->status_is(200) - ->content_type_is('application/json') - ->json_has('/title') - ->json_has('/intro_text') - ->json_has('/email') - ->json_has('/tid'); - #print STDERR Dumper -}; - -subtest 'comment preview' => sub { - my $test_data = { - title => "テストコメント", - comment => "コメントテスト本文\nてすとてすと" . localtime, - stoid => 1, - action => 'preview', - }; - $t->post_ok('/api/v1/comment' => {Accept => '*/*'} => json => $test_data) - ->status_is(200) - ->content_type_is('application/json') - ->json_has('/title') - ->json_has('/comment'); -}; - -done_testing(); -- 2.11.0