• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revision050a144a3761001624a51c182406f17252762806 (tree)
Zeit2012-04-20 05:54:24
AutorTim Van Steenburgh <tvansteenburgh@geek...>
CommiterYaroslav Luzin

Log Message

[#4014] Fixed bug in default milestone creation.

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@geek.net>

Ändern Zusammenfassung

Diff

--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -50,16 +50,22 @@ class TestMilestones(TrackerTestController):
5050 app = p.app_instance('bugs')
5151 app.globals.custom_fields = []
5252 ThreadLocalORMSession.flush_all()
53- r = self.app.post('/bugs/update_milestones',{
53+ d = {
5454 'field_name':'_milestone',
5555 'milestones-0.old_name':'',
5656 'milestones-0.new_name':'1.0',
5757 'milestones-0.description':'Version 1',
5858 'milestones-0.complete':'Open',
5959 'milestones-0.due_date':''
60- })
60+ }
61+ r = self.app.post('/bugs/update_milestones', d)
6162 r = self.app.get('/bugs/milestones')
6263 assert 'Version 1' in r
64+ # make sure _milestone doesn't get created again if it already exists
65+ r = self.app.post('/bugs/update_milestones', d)
66+ p = M.Project.query.get(shortname='test')
67+ app = p.app_instance('bugs')
68+ assert len(app.globals.custom_fields) == 1, len(app.globals.custom_fields)
6369
6470 class TestFunctionalController(TrackerTestController):
6571 def test_bad_ticket_number(self):
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -446,7 +446,7 @@ class RootController(BaseController):
446446 # the Edit Milestones page capable of editing any/all milestone fields
447447 # instead of just the default "_milestone" field.
448448 if field_name == '_milestone' and \
449- field_name not in c.app.globals.milestone_fields:
449+ field_name not in [m.name for m in c.app.globals.milestone_fields]:
450450 c.app.globals.custom_fields.append(dict(name='_milestone',
451451 label='Milestone', type='milestone', milestones=[]))
452452 for fld in c.app.globals.milestone_fields: