def test_context_is_not_task(config):
    from autonomie.views.taskaction import context_is_task
    context = MagicMock()
    for i in ("project_invoices", "project_cancelinvoices",
              "project_estimations"):
        context.__name__ = i
        assert not context_is_task(context)
示例#2
0
 def _set_financial_year_btn(self):
     """
         Return the button for the popup with the financial year set form
         of the current document
     """
     if context_is_task(self.context):
         title = u"Année comptable de référence"
         form = self._set_financial_year_form()
         popup = PopUp(
             "set_financial_year_form_container",
             title,
             form.render(),
         )
         self.request.popups[popup.name] = popup
         yield popup.open_btn(css='btn btn-primary')
示例#3
0
 def _set_financial_year_btn(self):
     """
         Return the button for the popup with the financial year set form
         of the current document
     """
     if context_is_task(self.context):
         title = u"Année comptable de référence"
         form = self._set_financial_year_form()
         popup = PopUp(
             "set_financial_year_form_container",
             title,
             form.render(),
         )
         self.request.popups[popup.name] = popup
         yield popup.open_btn(css='btn btn-primary')
示例#4
0
def test_context_is_not_task(config):
    from autonomie.views.taskaction import context_is_task
    context = MagicMock()
    for i in ("project_invoices", "project_cancelinvoices", "project_estimations"):
        context.__name__ = i
        assert not context_is_task(context)
示例#5
0
def test_context_is_task(config):
    from autonomie.views.taskaction import context_is_task
    context = MagicMock()
    for i in ("invoice", "cancelinvoice", "estimation"):
        context.__name__ = i
        assert(context_is_task(context))
示例#6
0
 def test_context_is_not_task(self):
     context = MagicMock()
     for i in ("project_invoices", "project_cancelinvoices", "project_estimations"):
         context.__name__ = i
         self.assertFalse(context_is_task(context))
示例#7
0
 def test_context_is_task(self):
     context = MagicMock()
     for i in ("invoice", "cancelinvoice", "estimation"):
         context.__name__ = i
         self.assertTrue(context_is_task(context))