Projet

Général

Profil

0001-backoffice-display-timeout-as-is-when-it-s-not-a-str.patch

Frédéric Péters, 05 juillet 2018 17:37

Télécharger (2,15 ko)

Voir les différences:

Subject: [PATCH] backoffice: display timeout as is when it's not a straight
 number (#25090)

 tests/test_backoffice_pages.py | 25 +++++++++++++++++++++++++
 wcs/workflows.py               |  5 ++++-
 2 files changed, 29 insertions(+), 1 deletion(-)
tests/test_backoffice_pages.py
4234 4234
    resp = resp.click('Management', index=0)
4235 4235
    resp = resp.follow()
4236 4236
    assert '8 open on 50' in resp.body  # only the accepted ones
4237

  
4238
def test_workflow_inspect_page(pub):
4239
    create_superuser(pub)
4240
    create_environment(pub, set_receiver=True)
4241

  
4242
    workflow = Workflow.get_default_workflow()
4243
    workflow.id = '2'
4244

  
4245
    st1 = workflow.add_status('Status1')
4246
    jump = JumpWorkflowStatusItem()
4247
    jump.id = '_jump'
4248
    jump.timeout = '=86400'
4249
    jump.status = 'finished'
4250
    st1.items.append(jump)
4251
    jump.parent = st1
4252
    workflow.store()
4253

  
4254
    app = login(get_app(pub))
4255
    resp = app.get('/backoffice/workflows/%s/inspect' % workflow.id)
4256
    assert '=86400'in resp.body
4257

  
4258
    jump.timeout = '82800'
4259
    workflow.store()
4260
    resp = app.get('/backoffice/workflows/%s/inspect' % workflow.id)
4261
    assert '23 hours' in resp.body
wcs/workflows.py
1620 1620
        return self.render_list_of_roles(self.by)
1621 1621

  
1622 1622
    def get_timeout_parameter_view_value(self):
1623
        return seconds2humanduration(int(self.timeout or 0))
1623
        try:
1624
            return seconds2humanduration(int(self.timeout or 0))
1625
        except ValueError:
1626
            return self.timeout  # probably an expression
1624 1627

  
1625 1628
    def get_status_parameter_view_value(self):
1626 1629
        for status in self.parent.parent.possible_status:
1627
-