incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [06/40] git commit: [#4429] ticket:458 fixed boolean value in mass edit
Date Wed, 30 Oct 2013 17:00:24 GMT
[#4429] ticket:458 fixed boolean value in mass edit


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f0f666f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f0f666f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f0f666f1

Branch: refs/heads/cj/6777
Commit: f0f666f164edb6bc5c3acc89cff1cc2c6e99fb2d
Parents: 8221856
Author: coldmind <sokandpal@yandex.ru>
Authored: Thu Oct 24 12:19:42 2013 +0300
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Thu Oct 24 17:19:04 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py       |  4 ++-
 .../forgetracker/tests/functional/test_root.py  | 32 +++++++++++++-------
 2 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f0f666f1/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index a55efab..5ce1087 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -26,7 +26,7 @@ import pymongo
 from pymongo.errors import OperationFailure
 from pylons import tmpl_context as c, app_globals as g
 from pprint import pformat
-from paste.deploy.converters import aslist
+from paste.deploy.converters import aslist, asbool
 import jinja2
 
 from ming import schema
@@ -363,6 +363,8 @@ class Globals(MappedClass):
                            else ticket.custom_fields.get(cf.name)
                 cf = custom_fields[k]
                 old_value = cf_val(cf)
+                if cf.type == 'boolean':
+                    v = asbool(v)
                 ticket.custom_fields[k] = v
                 new_value = cf_val(cf)
                 message += get_change_text(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f0f666f1/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 6fb5d43..acb1637 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -343,17 +343,17 @@ class TestFunctionalController(TrackerTestController):
         self.app.post(
             '/admin/bugs/set_custom_fields',
             params=variable_encode(params))
-        kw = {'custom_fields._major': 'True'}
+        kw = {'custom_fields._major': True}
         self.new_ticket(summary='First Custom', **kw)
-        kw = {'custom_fields._major': ''}
-        self.new_ticket(summary='Second Custom', **kw)
+        self.new_ticket(summary='Second Custom')
         M.MonQTask.run_ready()
 
         ticket1 = tm.Ticket.query.find({
             'summary': 'First Custom'}).first()
         ticket2 = tm.Ticket.query.find({
             'summary': 'Second Custom'}).first()
-
+        ticket2.custom_fields._major = None
+        ticket2.commit()
         self.app.post('/p/test/bugs/update_tickets', {
                       '__search': '',
                       '__ticket_ids': (
@@ -366,13 +366,13 @@ class TestFunctionalController(TrackerTestController):
         r = self.app.get('/p/test/bugs/1/')
         assert '<li><strong>Major</strong>: True --&gt; False</li>'
in r
         r = self.app.get('/p/test/bugs/2/')
-        assert '<li><strong>Major</strong>: True --&gt; False</li>'
not in r
+        assert '<li><strong>Major</strong>: --&gt; False</li>'
in r
         ticket1 = tm.Ticket.query.find({
             'summary': 'First Custom'}).first()
         ticket2 = tm.Ticket.query.find({
             'summary': 'Second Custom'}).first()
-        assert_equal(ticket1.custom_fields._major, u'False')
-        assert_equal(ticket2.custom_fields._major, u'False')
+        assert_equal(ticket1.custom_fields._major, False)
+        assert_equal(ticket2.custom_fields._major, False)
 
         self.app.post('/p/test/bugs/update_tickets', {
                       '__search': '',
@@ -391,12 +391,22 @@ class TestFunctionalController(TrackerTestController):
             'summary': 'First Custom'}).first()
         ticket2 = tm.Ticket.query.find({
             'summary': 'Second Custom'}).first()
-        assert_equal(ticket1.custom_fields._major, u'True')
-        assert_equal(ticket2.custom_fields._major, u'True')
+        assert_equal(ticket1.custom_fields._major, True)
+        assert_equal(ticket2.custom_fields._major, True)
 
         self.app.post('/p/test/bugs/update_tickets', {
                       '__search': '',
                       '__ticket_ids': (
+                          ticket2._id,),
+                      '_major': 'False'
+                      })
+        M.MonQTask.run_ready()
+        ticket2 = tm.Ticket.query.find({
+            'summary': 'Second Custom'}).first()
+        assert_equal(ticket2.custom_fields._major, False)
+        self.app.post('/p/test/bugs/update_tickets', {
+                      '__search': '',
+                      '__ticket_ids': (
                           ticket1._id,
                           ticket2._id,),
                       'status': 'accepted',
@@ -407,8 +417,8 @@ class TestFunctionalController(TrackerTestController):
             'summary': 'First Custom'}).first()
         ticket2 = tm.Ticket.query.find({
             'summary': 'Second Custom'}).first()
-        assert_equal(ticket1.custom_fields._major, u'True')
-        assert_equal(ticket2.custom_fields._major, u'True')
+        assert_equal(ticket1.custom_fields._major, True)
+        assert_equal(ticket2.custom_fields._major, False)
 
 
     def test_private_ticket(self):


Mime
View raw message