[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

eric at webkit.org eric at webkit.org
Wed Dec 22 14:44:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 99329a3348df52cd8ffe7ef21e890c7e346e8077
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 19 04:48:23 2010 +0000

    2010-10-18  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            Correct a bunch of typos in QueueStatusServer
            https://bugs.webkit.org/show_bug.cgi?id=47880
    
            These are all due to our complete lack of unit testing in QueueStatusServer.
            I added a couple unit tests to cover a few of these fixes, but most of these
            are still only caught by actually running the application.
    
            * QueueStatusServer/handlers/nextpatch.py:
            * QueueStatusServer/handlers/statusbubble.py:
            * QueueStatusServer/handlers/statusbubble_unittest.py: Added.
            * QueueStatusServer/handlers/updateworkitems.py:
            * QueueStatusServer/model/attachment.py:
            * QueueStatusServer/model/queuepropertymixin.py:
            * QueueStatusServer/model/queuepropertymixin_unittest.py:
            * QueueStatusServer/model/workitems.py:
            * QueueStatusServer/model/workitems_unittest.py: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70025 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f8f5fbe..500b77d 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,24 @@
+2010-10-18  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        Correct a bunch of typos in QueueStatusServer
+        https://bugs.webkit.org/show_bug.cgi?id=47880
+
+        These are all due to our complete lack of unit testing in QueueStatusServer.
+        I added a couple unit tests to cover a few of these fixes, but most of these
+        are still only caught by actually running the application.
+
+        * QueueStatusServer/handlers/nextpatch.py:
+        * QueueStatusServer/handlers/statusbubble.py:
+        * QueueStatusServer/handlers/statusbubble_unittest.py: Added.
+        * QueueStatusServer/handlers/updateworkitems.py:
+        * QueueStatusServer/model/attachment.py:
+        * QueueStatusServer/model/queuepropertymixin.py:
+        * QueueStatusServer/model/queuepropertymixin_unittest.py:
+        * QueueStatusServer/model/workitems.py:
+        * QueueStatusServer/model/workitems_unittest.py: Added.
+
 2010-10-18  Adam Barth  <abarth at webkit.org>
 
         Disable this test because it's failing on the bots and the authors
diff --git a/WebKitTools/QueueStatusServer/handlers/nextpatch.py b/WebKitTools/QueueStatusServer/handlers/nextpatch.py
index 5304a73..0571d7d 100644
--- a/WebKitTools/QueueStatusServer/handlers/nextpatch.py
+++ b/WebKitTools/QueueStatusServer/handlers/nextpatch.py
@@ -36,7 +36,7 @@ from model.queues import Queue
 
 class NextPatch(webapp.RequestHandler):
     def get(self, queue_name):
-        queue = Queue.queue_for_name(queue_name)
+        queue = Queue.queue_with_name(queue_name)
         if not queue:
             self.error(404)
             return
diff --git a/WebKitTools/QueueStatusServer/handlers/statusbubble.py b/WebKitTools/QueueStatusServer/handlers/statusbubble.py
index 0f1601f..5690484 100644
--- a/WebKitTools/QueueStatusServer/handlers/statusbubble.py
+++ b/WebKitTools/QueueStatusServer/handlers/statusbubble.py
@@ -42,7 +42,7 @@ class StatusBubble(webapp.RequestHandler):
     def _build_bubble(self, queue, attachment):
         queue_status = attachment.status_for_queue(queue)
         bubble = {
-            "name": queue.short_name().lowercase(),
+            "name": queue.short_name().lower(),
             "attachment_id": attachment.id,
             "queue_position": attachment.position_in_queue(queue),
             "state": attachment.state_from_queue_status(queue_status) if queue_status else "none",
diff --git a/WebKitTools/QueueStatusServer/handlers/statusbubble_unittest.py b/WebKitTools/QueueStatusServer/handlers/statusbubble_unittest.py
new file mode 100644
index 0000000..81a945f
--- /dev/null
+++ b/WebKitTools/QueueStatusServer/handlers/statusbubble_unittest.py
@@ -0,0 +1,62 @@
+# Copyright (C) 2010 Google, Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#    * Neither the name of Research in Motion Ltd. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import unittest
+
+
+from handlers.statusbubble import StatusBubble
+from model.queues import Queue
+
+
+class MockAttachment(object):
+    def __init__(self):
+        self.id = 1
+
+    def status_for_queue(self, queue):
+        return None
+
+    def position_in_queue(self, queue):
+        return 1
+
+
+class StatusBubbleTest(unittest.TestCase):
+    def test_build_bubble(self):
+        bubble = StatusBubble()
+        queue = Queue("mac-ews")
+        attachment = MockAttachment()
+        bubble_dict = bubble._build_bubble(queue, attachment)
+        # FIXME: assertDictEqual (in Python 2.7) would be better to use here.
+        self.assertEqual(bubble_dict["name"], "mac")
+        self.assertEqual(bubble_dict["attachment_id"], 1)
+        self.assertEqual(bubble_dict["queue_position"], "1")
+        self.assertEqual(bubble_dict["state"], "none")
+        self.assertEqual(bubble_dict["status"], None)
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/WebKitTools/QueueStatusServer/handlers/updateworkitems.py b/WebKitTools/QueueStatusServer/handlers/updateworkitems.py
index 7743297..6fe32bb 100644
--- a/WebKitTools/QueueStatusServer/handlers/updateworkitems.py
+++ b/WebKitTools/QueueStatusServer/handlers/updateworkitems.py
@@ -54,7 +54,7 @@ class UpdateWorkItems(UpdateBase):
 
     def _work_items_from_request(self):
         queue_name = self.request.get("queue_name")
-        queue = Queue.queue_for_name(queue_name)
+        queue = Queue.queue_with_name(queue_name)
         if not queue:
             self.response.out.write("\"%s\" is not in queues %s" % (queue_name, Queue.all()))
             return None
diff --git a/WebKitTools/QueueStatusServer/model/attachment.py b/WebKitTools/QueueStatusServer/model/attachment.py
index 9a887e9..f98f265 100644
--- a/WebKitTools/QueueStatusServer/model/attachment.py
+++ b/WebKitTools/QueueStatusServer/model/attachment.py
@@ -108,7 +108,7 @@ class Attachment(object):
         return self._cached_queue_positions
 
     def _calculate_queue_positions(self):
-        all_work_items = WorkItems.all().fetch(limit=len(Queues.all()))
+        all_work_items = WorkItems.all().fetch(limit=len(Queue.all()))
         return dict([(items.queue.name(), items.display_position_for_attachment(self.id)) for items in all_work_items])
 
     # FIXME: This is controller/view code and does not belong in a model.
@@ -121,7 +121,7 @@ class Attachment(object):
             return summary
         summary["bug_id"] = first_status.active_bug_id
 
-        for queue in Queues.all():
+        for queue in Queue.all():
             summary[queue.name_with_underscores()] = None
             status = QueueStatus.all().filter('queue_name =', queue.name()).filter('active_patch_id =', self.id).order('-date').get()
             if status:
diff --git a/WebKitTools/QueueStatusServer/model/queuepropertymixin.py b/WebKitTools/QueueStatusServer/model/queuepropertymixin.py
index 8f9cc29..a462586 100644
--- a/WebKitTools/QueueStatusServer/model/queuepropertymixin.py
+++ b/WebKitTools/QueueStatusServer/model/queuepropertymixin.py
@@ -31,7 +31,7 @@ class QueuePropertyMixin(object):
     def _queue_getter(self):
         # Import at runtime to avoid circular imports
         from model.queues import Queue
-        return Queue.queue_from_name(self.queue_name)
+        return Queue.queue_with_name(self.queue_name)
 
     def _queue_setter(self, queue):
         self.queue_name = queue.name() if queue else None
diff --git a/WebKitTools/QueueStatusServer/model/queuepropertymixin_unittest.py b/WebKitTools/QueueStatusServer/model/queuepropertymixin_unittest.py
index 3841a9f..9a301fe 100644
--- a/WebKitTools/QueueStatusServer/model/queuepropertymixin_unittest.py
+++ b/WebKitTools/QueueStatusServer/model/queuepropertymixin_unittest.py
@@ -42,6 +42,7 @@ class QueuePropertyMixinTest(unittest.TestCase):
         test_object = ObjectWithQueueName()
         mac_ews = Queue("mac-ews")
         test_object.queue = mac_ews
+        self.assertEquals(test_object.queue.name(), "mac-ews")
         self.assertEquals(test_object.queue_name, "mac-ews")
         test_object.queue = None
         self.assertEquals(test_object.queue_name, None)
diff --git a/WebKitTools/QueueStatusServer/model/workitems.py b/WebKitTools/QueueStatusServer/model/workitems.py
index c39f790..d22e0c2 100644
--- a/WebKitTools/QueueStatusServer/model/workitems.py
+++ b/WebKitTools/QueueStatusServer/model/workitems.py
@@ -40,7 +40,7 @@ class WorkItems(db.Model, QueuePropertyMixin):
         """Returns a 1-based index corresponding to the position
         of the attachment_id in the queue.  If the attachment is
         not in this queue, this returns None"""
-        if attachment_id in attachment_id:
+        if attachment_id in self.item_ids:
             return self.item_ids.index(attachment_id) + 1
         return None
 
diff --git a/WebKitTools/QueueStatusServer/model/workitems_unittest.py b/WebKitTools/QueueStatusServer/model/workitems_unittest.py
new file mode 100644
index 0000000..b1ff1d3
--- /dev/null
+++ b/WebKitTools/QueueStatusServer/model/workitems_unittest.py
@@ -0,0 +1,45 @@
+# Copyright (C) 2010 Google, Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#    * Neither the name of Research in Motion Ltd. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import unittest
+
+
+from model.workitems import WorkItems
+
+
+class WorkItemsTest(unittest.TestCase):
+    def test_display_position_for_attachment(self):
+        items = WorkItems()
+        items.item_ids = [0, 1, 2]
+        self.assertEquals(items.display_position_for_attachment(0), 1)
+        self.assertEquals(items.display_position_for_attachment(1), 2)
+        self.assertEquals(items.display_position_for_attachment(3), None)
+
+
+if __name__ == '__main__':
+    unittest.main()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list