| | 155 | api => 'mt.getRecentPostTitles', |
| | 156 | params => [ 1, $username, $password, 3 ], |
| | 157 | result => sub { |
| | 158 | my ( $som ) = @_; |
| | 159 | my $result = $som->result; |
| | 160 | is(scalar(@$result), 3); |
| | 161 | my @entries = MT::Entry->load({ |
| | 162 | blog_id => 1, |
| | 163 | }, { |
| | 164 | 'sort' => 'authored_on', |
| | 165 | 'direction' => 'descend', |
| | 166 | limit => 3, |
| | 167 | }); |
| | 168 | for ( my $i = 0; $i < 3; ++$i ) { |
| | 169 | is( $entries[$i]->id, $result->[$i]->{postid} ); |
| | 170 | is( $entries[$i]->title, $result->[$i]->{title} ); |
| | 171 | } |
| | 172 | }, |
| | 173 | }, |
| | 174 | { |
| 366 | | api => 'blogger.deletePost', |
| | 386 | api => 'metaWeblog.getPost', |
| | 387 | params => [ 24, $username, $password ], |
| | 388 | pre => sub { |
| | 389 | my ( $e2 ) = MT::Entry->load(undef, |
| | 390 | { sort => 'created_on', direction => 'descend', limit => 1 } |
| | 391 | ); |
| | 392 | is( $e2->id, 24 ); |
| | 393 | return $e2; |
| | 394 | }, |
| | 395 | result => sub { |
| | 396 | my ( $som ) = @_; |
| | 397 | my $result = $som->result; |
| | 398 | my $entry = MT::Entry->load(24); |
| | 399 | ok($entry); |
| | 400 | is($entry->permalink, $result->{permaLink}); |
| | 401 | is($entry->basename, $result->{mt_basename}); |
| | 402 | is($entry->text, $result->{description}); |
| | 403 | }, |
| | 404 | }, |
| | 405 | { |
| | 406 | api => 'metaWeblog.deletePost', |
| | 454 | { |
| | 455 | api => 'metaWeblog.getCategories', |
| | 456 | params => [ 1, $username, $password ], |
| | 457 | result => sub { |
| | 458 | my ( $som ) = @_; |
| | 459 | my $result = $som->result; |
| | 460 | my @cats = MT::Category->load({blog_id=>1}); |
| | 461 | for ( my $i = 0; $i <= $#cats; ++$i ) { |
| | 462 | is($cats[$i]->id, $result->[$i]->{categoryId}); |
| | 463 | is($cats[$i]->label, $result->[$i]->{categoryName}); |
| | 464 | is($cats[$i]->description, $result->[$i]->{description}); |
| | 465 | if ( my $parent = $cats[$i]->parent_category ) { |
| | 466 | is($parent->id, $result->[$i]->{parentId}); |
| | 467 | } |
| | 468 | else { |
| | 469 | ok(!($result->[$i]->{parentId})); |
| | 470 | } |
| | 471 | } |
| | 472 | is(scalar(@$result), scalar(@cats)); |
| | 473 | }, |
| | 474 | }, |
| | 475 | { |
| | 476 | api => 'mt.getTrackbackPings', |
| | 477 | params => [ 1, $username, $password ], |
| | 478 | result => sub { |
| | 479 | my ( $som ) = @_; |
| | 480 | my $result = $som->result; |
| | 481 | my @pings = MT::TBPing->load( undef, { |
| | 482 | 'join' => MT::Trackback->join_on( undef, { |
| | 483 | id => \'= tbping_tb_id', |
| | 484 | }, { |
| | 485 | 'join' => MT::Entry->join_on( undef, { |
| | 486 | id => \'= trackback_entry_id', |
| | 487 | class => 'entry', |
| | 488 | } |
| | 489 | ) } |
| | 490 | ) } ); |
| | 491 | for ( my $i = 0; $i <= $#pings; ++$i ) { |
| | 492 | is($pings[$i]->ip, $result->[$i]->{pingIP}); |
| | 493 | is($pings[$i]->source_url, $result->[$i]->{pingURL}); |
| | 494 | is($pings[$i]->title, $result->[$i]->{pingTitle}); |
| | 495 | } |
| | 496 | is(scalar(@$result), scalar(@pings)); |
| | 497 | }, |
| | 498 | }, |
| | 499 | { |
| | 500 | api => 'mt.supportedTextFilters', |
| | 501 | params => [ $username, $password ], |
| | 502 | result => sub { |
| | 503 | my ( $som ) = @_; |
| | 504 | my $result = $som->result; |
| | 505 | my %tf = ( |
| | 506 | '__default__' => 1, |
| | 507 | 'richtext' => 1, |
| | 508 | 'markdown' => 1, |
| | 509 | 'markdown_with_smartypants' => 1, |
| | 510 | 'textile_2' => 1, |
| | 511 | ); |
| | 512 | foreach my $res ( @$result ) { |
| | 513 | is(1, delete( $tf{$res->{key}} ), $res->{key}); |
| | 514 | } |
| | 515 | ok(!%tf); |
| | 516 | }, |
| | 517 | }, |
| | 518 | { |
| | 519 | api => 'mt.getTagList', |
| | 520 | params => [ 1, $username, $password ], |
| | 521 | result => sub { |
| | 522 | my ( $som ) = @_; |
| | 523 | my $result = $som->result; |
| | 524 | my @tags = MT::Tag->load(undef, { |
| | 525 | 'join' => MT::ObjectTag->join_on(undef, { |
| | 526 | tag_id => \'= tag_id', |
| | 527 | blog_id => 1 |
| | 528 | }, { unique => 1 }) |
| | 529 | }); |
| | 530 | for ( my $i = 0; $i <= $#tags; ++$i ) { |
| | 531 | is($tags[$i]->id, $result->[$i]->{tagId}); |
| | 532 | is($tags[$i]->name, $result->[$i]->{tagName}); |
| | 533 | } |
| | 534 | is(scalar(@$result), scalar(@tags)); |
| | 535 | }, |
| | 536 | }, |