fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-02-17 09:52 am

[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 [personal profile] fu.

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" );
+        }
     }
 }
--------------------------------------------------------------------------------
kareila: (Default)

[personal profile] kareila 2011-03-01 03:42 pm (UTC)(link)
I'm also still seeing failures with this test, even with memcache running:

#   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.
kareila: (Default)

[personal profile] kareila 2011-03-01 05:17 pm (UTC)(link)
It's been consistent in my testing so far this morning! I can't remember if this is the first time I've run tests since the relevant changes went in, though.
kareila: (Default)

[personal profile] kareila 2011-03-01 05:43 pm (UTC)(link)
http://pastebin.com/hY3gMQb3

I think that worked... heh first time using pastebin.
kareila: (Default)

[personal profile] kareila 2011-03-01 11:18 pm (UTC)(link)
Oh, really? Okay, can you poke Sophie this time? I'm getting ready for a meeting...
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2011-03-02 07:33 am (UTC)(link)
Upgraded again. :)

I guess I should probably think of reinstalling the whole thing with a new version of Ubuntu...