← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~sinzui/launchpad/enable-tests-0 into lp:launchpad/devel

 

Curtis Hovey has proposed merging lp:~sinzui/launchpad/enable-tests-0 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #318842 postings.txt fails when run under a non-English locale
  https://bugs.launchpad.net/bugs/318842
  #383615 Spurious test failure in emailaddress.txt.
  https://bugs.launchpad.net/bugs/383615
  #488491 tests/test_lp_collapsibles fails
  https://bugs.launchpad.net/bugs/488491


This is my branch to enable broken tests.

    lp:~sinzui/launchpad/enable-tests-0
    Diff size: 233
    Launchpad bug:
        https://bugs.launchpad.net/bugs/488491
        https://bugs.launchpad.net/bugs/383615
        https://bugs.launchpad.net/bugs/318842
    Test command: ./bin/test -vv \
        -t '(app|registry)/.*test_yuitests'
        -t doc/emailaddress
    Test command: ./bin/test -vv --layer=Mailman -t postings
    Pre-implementation: no one
    Target release: 10.12


Enable broken tests
-------------------

Bug 488491 tests/test_lp_collapsibles fails
    The test was not updated propery when the module was moved and
    lazr.effects was added.

Bug 383615 Spurious test failure in emailaddress.txt
    The test was disabled because of a suprious failure. The failure though
    is in factory.makePerson() in setup (before the test has done anything).
    If there was a real problem, we would be seeing this very often. I know
    that makePerson and the rules for account have changed this year, so
    we should re-enable this.

Bug 318842 postings.txt can fail when run in a non-English locale
    The page test expects the English Mailman message


Rules
-----

Bug 488491 tests/test_lp_collapsibles fails
    * Fix the script and css imports in the harness (the html page)
    * Fix the imports in the js test
    * Fix the test broken by the switch to lazr.effects. the setup in
      test_toggle_collapsible_opens_collapsed_collapsible needs to use
      the lazr-close class. The collapsible script does not use the
      lazr-open class.
    * Fix _should.error. The test confused exceptions and assertions.
      _should.error checks for *exceptions*, but the collapsible script uses
      the fail assertion, which is an *event*. change _should.error to
      _should.fail to ensure something is listening for the event.
    * Add a yuitest harness so that the test is run in the test runner.

Bug 383615 Spurious test failure in emailaddress.txt
    * Rename the test
    * Update the imports that were not updated when modules were moved.

Bug 318842 postings.txt can fail when run in a non-English locale
    * Remove the body of the message, the header already states that the
      message was rejects.


Lint
----

Linting changed files:
  lib/canonical/launchpad/doc/emailaddress.txt
  lib/lp/app/windmill/
  lib/lp/app/javascript/tests/test_lp_collapsibles.html
  lib/lp/app/javascript/tests/test_lp_collapsibles.js
  lib/lp/app/windmill/__init__.py
  lib/lp/app/windmill/testing.py
  lib/lp/app/windmill/tests/
  lib/lp/app/windmill/tests/__init__.py
  lib/lp/app/windmill/tests/test_yuitests.py
  lib/lp/registry/javascript/tests/test_milestone_table.html
  lib/lp/services/mailman/doc/postings.txt


Test
----

Renamed the test and updated the imports:
    lib/canonical/launchpad/doc/emailaddress.txt

Fixed import, correct the setup for lazr.effects, and used _should.fail when
checking for assertion events.
    lib/lp/app/javascript/tests/test_lp_collapsibles.html
    lib/lp/app/javascript/tests/test_lp_collapsibles.js

Added a test harness to run the lp.app YUI unittests
    lib/lp/app/windmill/__init__.py
    lib/lp/app/windmill/testing.py
    lib/lp/app/windmill/tests/__init__.py
    lib/lp/app/windmill/tests/test_yuitests.py

Fixed the css import in the html test harness. (You can spot the failure
while watching the test log scroll)
    lib/lp/registry/javascript/tests/test_milestone_table.html

Removed the part localisable part of the message.
    lib/lp/services/mailman/doc/postings.txt
-- 
https://code.launchpad.net/~sinzui/launchpad/enable-tests-0/+merge/41088
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/enable-tests-0 into lp:launchpad/devel.
=== renamed file 'lib/canonical/launchpad/doc/emailaddress.txt.disabled' => 'lib/canonical/launchpad/doc/emailaddress.txt'
--- lib/canonical/launchpad/doc/emailaddress.txt.disabled	2009-08-13 19:03:36 +0000
+++ lib/canonical/launchpad/doc/emailaddress.txt	2010-11-17 19:23:42 +0000
@@ -1,4 +1,5 @@
-= Email Addresses =
+Email Addresses
+===============
 
 In Launchpad we use email addresses to uniquely identify a person. This is why
 email addresses must be unique.
@@ -22,7 +23,7 @@
 
 Email addresses provide both IEmailAddress and IHasOwner.
 
-    >>> from canonical.launchpad.interfaces.launchpad import IHasOwner
+    >>> from lp.registry.interfaces.role import IHasOwner
     >>> verifyObject(IEmailAddress, email)
     True
     >>> verifyObject(IHasOwner, email)
@@ -66,11 +67,12 @@
     [u'celso.providelo@xxxxxxxxxxxxx', u'colin.watson@xxxxxxxxxxxxxxx',
      u'daniel.silverstone@xxxxxxxxxxxxx', u'edgar@xxxxxxxxxxxxxxxx',
      u'foo.bar@xxxxxxxxxxxxx', u'jeff.waugh@xxxxxxxxxxxxxxx',
-     u'limi@xxxxxxxxx', u'mark@xxxxxxxxxxx', u'steve.alexander@xxxxxxxxxxxxxxx',
-     u'support@xxxxxxxxxx']
-
-
-== Deleting email addresses ==
+     u'limi@xxxxxxxxx', u'mark@xxxxxxxxxxx',
+     u'steve.alexander@xxxxxxxxxxxxxxx', u'support@xxxxxxxxxx']
+
+
+Deleting email addresses
+------------------------
 
 Email addresses may be deleted if they're not a person's preferred one
 or the address of a team's mailing list.

=== modified file 'lib/lp/app/javascript/tests/test_lp_collapsibles.html'
--- lib/lp/app/javascript/tests/test_lp_collapsibles.html	2010-07-26 13:42:32 +0000
+++ lib/lp/app/javascript/tests/test_lp_collapsibles.html	2010-11-17 19:23:42 +0000
@@ -4,14 +4,14 @@
   <title>Launchpad Collapsibles</title>
 
   <!-- YUI 3.0 Setup -->
-  <script type="text/javascript" src="../../../icing/yui/yui/yui.js"></script>
-  <link rel="stylesheet" href="../../../icing/yui/cssreset/reset.css"/>
-  <link rel="stylesheet" href="../../../icing/yui/cssfonts/fonts.css"/>
-  <link rel="stylesheet" href="../../../icing/yui/cssbase/base.css"/>
-  <link rel="stylesheet" href="../../test.css" />
+  <script type="text/javascript" src="../../../../canonical/launchpad/icing/yui/yui/yui.js"></script>
+  <script type="text/javascript" src="../../../../canonical/launchpad/icing/lazr/build/lazr.js"></script>
+  <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssreset/reset.css"/>
+  <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css"/>
+  <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssbase/base.css"/>
+  <link rel="stylesheet" href="../../../../canonical/launchpad/javascript/test.css" />
 
   <!-- The module under test -->
-  <script type="text/javascript" src="../../../icing/lazr/build/effects/effects.js"></script>
   <script type="text/javascript" src="../lp.js"></script>
 
   <!-- The test suite -->

=== modified file 'lib/lp/app/javascript/tests/test_lp_collapsibles.js'
--- lib/lp/app/javascript/tests/test_lp_collapsibles.js	2010-07-26 13:42:32 +0000
+++ lib/lp/app/javascript/tests/test_lp_collapsibles.js	2010-11-17 19:23:42 +0000
@@ -1,21 +1,21 @@
 /* Copyright (c) 2009, Canonical Ltd. All rights reserved. */
 
 YUI({
-    base: '../../../icing/yui/',
+    base: '../../../../canonical/launchpad/icing/yui/',
     filter: 'raw',
     combine: false
     }).use('test', 'console', 'lp', function(Y) {
 
 var Assert = Y.Assert;  // For easy access to isTrue(), etc.
 
-Y.Test.Runner.add(new Y.Test.Case({
+var suite = new Y.Test.Suite("Collapsibles Tests");
+suite.add(new Y.Test.Case({
     name: "activate_collapsibles",
 
     _should: {
-        error: {
+        fail: {
             test_toggle_collapsible_fails_on_wrapperless_collapsible: true,
             test_toggle_collapsible_fails_on_iconless_collapsible: true,
-            test_activate_collapsibles_handles_no_collapsibles: false
         }
     },
 
@@ -149,17 +149,16 @@
     test_toggle_collapsible_opens_collapsed_collapsible: function() {
         // Calling toggle_collapsible() on a collapsed collapsible will
         // toggle its state to open.
+        Y.lp.activate_collapsibles();
         var collapsible = this.container.one('.collapsible');
-        collapsible.addClass('collapsed');
+        var wrapper_div = collapsible.one('.collapseWrapper');
+        wrapper_div.addClass('lazr-closed');
 
-        Y.lp.activate_collapsibles();
         Y.lp.toggle_collapsible(collapsible);
         this.wait(function() {
-
             // The collapsible's wrapper div will now be open.
             var icon = collapsible.one('img');
-            var wrapper_div = collapsible.one('.collapseWrapper');
-            Assert.isTrue(wrapper_div.hasClass('lazr-open'));
+            Assert.isFalse(wrapper_div.hasClass('lazr-closed'));
             Assert.areNotEqual(
                 -1, icon.get('src').indexOf('/@@/treeExpanded'));
         }, 500);
@@ -321,6 +320,15 @@
     }
 }));
 
+// Lock, stock, and two smoking barrels.
+var handle_complete = function(data) {
+    status_node = Y.Node.create(
+        '<p id="complete">Test status: complete</p>');
+    Y.get('body').appendChild(status_node);
+    };
+Y.Test.Runner.on('complete', handle_complete);
+Y.Test.Runner.add(suite);
+
 var yui_console = new Y.Console({
     newestOnTop: false
 });

=== added directory 'lib/lp/app/windmill'
=== added file 'lib/lp/app/windmill/__init__.py'
=== added file 'lib/lp/app/windmill/testing.py'
--- lib/lp/app/windmill/testing.py	1970-01-01 00:00:00 +0000
+++ lib/lp/app/windmill/testing.py	2010-11-17 19:23:42 +0000
@@ -0,0 +1,21 @@
+# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Launchpad app specific testing infrastructure for Windmill."""
+
+__metaclass__ = type
+__all__ = [
+    'AppWindmillLayer',
+    ]
+
+
+from canonical.testing.layers import BaseWindmillLayer
+
+
+class AppWindmillLayer(BaseWindmillLayer):
+    """Layer for App Windmill tests."""
+
+    @classmethod
+    def setUp(cls):
+        cls.base_url = cls.appserver_root_url()
+        super(AppWindmillLayer, cls).setUp()

=== added directory 'lib/lp/app/windmill/tests'
=== added file 'lib/lp/app/windmill/tests/__init__.py'
=== added file 'lib/lp/app/windmill/tests/test_yuitests.py'
--- lib/lp/app/windmill/tests/test_yuitests.py	1970-01-01 00:00:00 +0000
+++ lib/lp/app/windmill/tests/test_yuitests.py	2010-11-17 19:23:42 +0000
@@ -0,0 +1,24 @@
+# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Run YUI.test tests."""
+
+__metaclass__ = type
+__all__ = []
+
+from lp.app.windmill.testing import AppWindmillLayer
+from lp.testing import (
+    build_yui_unittest_suite,
+    YUIUnitTestCase,
+    )
+
+
+class AppYUIUnitTestCase(YUIUnitTestCase):
+
+    layer = AppWindmillLayer
+    suite_name = 'AppYUIUnitTests'
+
+
+def test_suite():
+    app_testing_path = 'lp/app/javascript/tests'
+    return build_yui_unittest_suite(app_testing_path, AppYUIUnitTestCase)

=== modified file 'lib/lp/registry/javascript/tests/test_milestone_table.html'
--- lib/lp/registry/javascript/tests/test_milestone_table.html	2010-04-28 18:43:25 +0000
+++ lib/lp/registry/javascript/tests/test_milestone_table.html	2010-11-17 19:23:42 +0000
@@ -9,7 +9,7 @@
   <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssreset/reset.css"/>
   <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css"/>
   <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssbase/base.css"/>
-  <link rel="stylesheet" href="../../../canonical/launchpad/javascript/test.css" />
+  <link rel="stylesheet" href="../../../../canonical/launchpad/javascript/test.css" />
 
   <!-- The module under test -->
   <script type="text/javascript" src="../milestonetable.js"></script>

=== modified file 'lib/lp/services/mailman/doc/postings.txt'
--- lib/lp/services/mailman/doc/postings.txt	2010-10-25 12:11:43 +0000
+++ lib/lp/services/mailman/doc/postings.txt	2010-11-17 19:23:42 +0000
@@ -177,25 +177,6 @@
     From: itest-one-...@xxxxxxxxxxxxxxxxxxx
     To: anne.person@xxxxxxxxxxx
     ...
-    Sender: itest-one-bounces+anne.person=example.com@xxxxxxxxxxxxxxxxxxx
-    Errors-To: itest-one-bounces+anne.person=example.com@xxxxxxxxxxxxxxxxxxx
-    ...
-    X-MailFrom: itest-one-bounces+anne.person=example.com@xxxxxxxxxxxxxxxxxxx
-    X-RcptTo: anne.person@xxxxxxxxxxx
-    <BLANKLINE>
-    Your request to the Itest-one mailing list
-    <BLANKLINE>
-        Posting of your message titled "An unsubscribed post"
-    <BLANKLINE>
-    has been rejected by the list moderator.  The moderator gave the
-    following reason for rejecting your request:
-    <BLANKLINE>
-    "[No reason given]"
-    <BLANKLINE>
-    Any questions or comments should be directed to the list administrator
-    at:
-    <BLANKLINE>
-        itest-one-owner@xxxxxxxxxxxxxxxxxxx
 
 Anne posts another message to the mailing list, but she is still not
 subscribed to it.  The team administrator deems this message to be spam and