use t::oEmbed;
plan skip_all => "inc/.author is not there" unless -e "inc/.author";
plan tests => 2 * blocks;
use Web::oEmbed;
my $consumer = Web::oEmbed->new;
my $providers = read_json("t/providers.json");
for my $provider (@$providers) {
$consumer->register_provider($provider);
}
run {
my $block = shift;
my $res1 = $consumer->embed($block->input, { format => 'json' });
my $res2 = $consumer->embed($block->input, { format => 'xml' });
is $res1->url, $res2->url;
is canon($res1->render), canon($block->html);
};
sub canon {
use HTML::TreeBuilder;
my $t = HTML::TreeBuilder->new;
$t->parse(shift);
return $t->as_HTML;
}
__END__
===
--- input: http://www.flickr.com/photos/bees/2362225867/
--- html:
===
--- input: http://www.vimeo.com/757219
--- html