[dw-free] clean-embed tests failing when memcached is disabled
[commit: http://hg.dwscoalition.org/dw-free/rev/2bd57d9f7bf5]
http://bugs.dwscoalition.org/show_bug.cgi?id=3513
Accept a certain amount of whitespace in the results returned by the HTML
cleaner.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3513
Accept a certain amount of whitespace in the results returned by the HTML
cleaner.
Patch by
Files modified:
- t/clean-embed.t
--------------------------------------------------------------------------------
diff -r f91104d03d57 -r 2bd57d9f7bf5 t/clean-embed.t
--- a/t/clean-embed.t Wed Feb 16 16:10:51 2011 -0600
+++ b/t/clean-embed.t Thu Feb 17 17:51:10 2011 +0800
@@ -218,9 +218,9 @@ note( "Testing parse_embed (We parse the
qq{foo <site-embed id="1"> </site-embed> bar},
qq{foo <site-embed id="1"/> bar},
- qq{foo <site-embed id="1"></site-embed> bar},
+ qr{foo <site-embed id="1">\s*</site-embed> bar},
qr{foo $iframe bar},
- qq{},
+ qr{\s*},
],
@@ -407,7 +407,11 @@ note( "Testing parse_embed (We parse the
# edit the post
my $expanded_entry = $got_post_saved;
LJ::EmbedModule->expand_entry( $u, \$expanded_entry, edit => 1 );
- is( $expanded_entry, $expected_edit, "expand_entry: $title" );
+ if ( ref $expected_edit && ref $expected_edit eq "Regexp" ) {
+ like( $expanded_entry, $expected_edit, "expand entry: $title" );
+ } else {
+ is( $expanded_entry, $expected_edit, "expand_entry: $title" );
+ }
# view the post in your journal (get iframe if applicable)
my $viewed_entry = $got_post_saved;
@@ -436,6 +440,10 @@ note( "Testing parse_embed (We parse the
# check the iframe contents
# LJ::EmbedModule takes the content and cleans it
my $got_embed = LJ::EmbedModule->module_content( journalid => $u->userid, moduleid => 1 );
- is( $got_embed, $expected_iframe, "clean_embed: $title" );
+ if( ref $expected_iframe && ref $expected_iframe eq "Regexp" ) {
+ like( $got_embed, $expected_iframe, "clean_embed: $title" );
+ } else {
+ is( $got_embed, $expected_iframe, "clean_embed: $title" );
+ }
}
}
--------------------------------------------------------------------------------

no subject
# Failed test '<iframe> tag: nested trusted and untrusted' # at t/clean-embed.t line 125. # got: '<iframe src="http://www.youtube.com/embed/ABC123abc-_"></iframe>' # expected: '<iframe src="http://www.youtube.com/embed/ABC123abc-_"><iframe src="http://not-youtube.com/embed/ABC123abc-_"></iframe>' # Failed test '<iframe> tag: nested trusted with script tags' # at t/clean-embed.t line 130. # got: '<iframe src="http://www.youtube.com/embed/ABC123abc-_"></iframe>' # expected: '<iframe src="http://www.youtube.com/embed/ABC123abc-_"><script type="text/javascript">alert("hi");</script></iframe>' # Failed test '<iframe> tag: nested trusted with style tags' # at t/clean-embed.t line 135. # got: '<iframe src="http://www.youtube.com/embed/ABC123abc-_"> # <style> # /* cleaned */ # alert(document["coo"+"kies"])</style> # </iframe>' # expected: '<iframe src="http://www.youtube.com/embed/ABC123abc-_"><style type="text/css">alert(document["coo"+"kies"])</style></iframe>' # Failed test 'parse_module_embed: iframe tag left open in site-embed (untrusted)' # at t/clean-embed.t line 405. # got: 'foo <site-embed id="1"/> baz' # expected: 'foo ' # Failed test 'expand_entry: iframe tag left open in site-embed (untrusted)' # at t/clean-embed.t line 413. # got: 'foo <site-embed id="1"></site-embed> baz' # expected: 'foo ' # Failed test 'clean_embed: iframe tag left open in site-embed (untrusted)' # at t/clean-embed.t line 446. # got: '' # expected: '[Invalid lj-embed id 1]' # Failed test 'parse_module_embed: iframe tag left open in site-embed (trusted)' # at t/clean-embed.t line 405. # got: 'foo <site-embed id="1"/> baz' # expected: 'foo ' # Failed test 'expand_entry: iframe tag left open in site-embed (trusted)' # at t/clean-embed.t line 413. # got: 'foo <site-embed id="1"><iframe src="http://www.youtube.com/embed/ABC123abc_-"></site-embed> baz' # expected: 'foo ' # Failed test 'clean_embed: iframe tag left open in site-embed (trusted)' # at t/clean-embed.t line 446. # got: '<iframe src="http://www.youtube.com/embed/ABC123abc_-">' # expected: '[Invalid lj-embed id 1]' # Looks like you planned 142 tests but ran 150. # Looks like you failed 9 tests of 150 run.no subject
no subject
no subject
no subject
I think that worked... heh first time using pastebin.
no subject
Umm. This looks like another versioning issue though. The version I have of HTML::TokeParser is 3.57, whereas the one on the 'hack is 2... something. The one in prod is similar to my version so I think it'd behave the same way.
no subject
no subject
no subject
I guess I should probably think of reinstalling the whole thing with a new version of Ubuntu...