allura
Revision | 050a144a3761001624a51c182406f17252762806 (tree) |
---|---|
Zeit | 2012-04-20 05:54:24 |
Autor | Tim Van Steenburgh <tvansteenburgh@geek...> |
Commiter | Yaroslav Luzin |
[#4014] Fixed bug in default milestone creation.
Signed-off-by: Tim Van Steenburgh <tvansteenburgh@geek.net>
@@ -50,16 +50,22 @@ class TestMilestones(TrackerTestController): | ||
50 | 50 | app = p.app_instance('bugs') |
51 | 51 | app.globals.custom_fields = [] |
52 | 52 | ThreadLocalORMSession.flush_all() |
53 | - r = self.app.post('/bugs/update_milestones',{ | |
53 | + d = { | |
54 | 54 | 'field_name':'_milestone', |
55 | 55 | 'milestones-0.old_name':'', |
56 | 56 | 'milestones-0.new_name':'1.0', |
57 | 57 | 'milestones-0.description':'Version 1', |
58 | 58 | 'milestones-0.complete':'Open', |
59 | 59 | 'milestones-0.due_date':'' |
60 | - }) | |
60 | + } | |
61 | + r = self.app.post('/bugs/update_milestones', d) | |
61 | 62 | r = self.app.get('/bugs/milestones') |
62 | 63 | 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) | |
63 | 69 | |
64 | 70 | class TestFunctionalController(TrackerTestController): |
65 | 71 | def test_bad_ticket_number(self): |
@@ -446,7 +446,7 @@ class RootController(BaseController): | ||
446 | 446 | # the Edit Milestones page capable of editing any/all milestone fields |
447 | 447 | # instead of just the default "_milestone" field. |
448 | 448 | 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]: | |
450 | 450 | c.app.globals.custom_fields.append(dict(name='_milestone', |
451 | 451 | label='Milestone', type='milestone', milestones=[])) |
452 | 452 | for fld in c.app.globals.milestone_fields: |