def test_handle_done_5_with_done_true_and_completed_on_in_past_that_completed_on_remains(self):
     # Completed on shouldn't change if nothing has changed
     actionitem = ActionItem()
     actionitem.completed_on = completed_on = random_date()
     actionitem.done = True
     actionitem = actionitem.handle_done(actionitem)
     assert actionitem.completed_on == completed_on
 def test_handle_done_3_with_done_set_when_completed_on_has_not_been_set(self):
     # With actionitem.done set, completed on should be set
     actionitem = ActionItem()
     actionitem.done = True
     actionitem = actionitem.handle_done(actionitem)
     delta = actionitem.completed_on - datetime.utcnow().replace(tzinfo=utc)
     assert abs(delta) <= timedelta(milliseconds=10), 'Times are not almost equal'
 def test_handle_done_2_with_done_null_when_completed_on_has_initial_value(self):
     # With actionitem.done not set, completed on should be forced empty
     actionitem = ActionItem()
     actionitem.completed_on = random_date()
     print actionitem.completed_on
     actionitem = actionitem.handle_done(actionitem)
     assert actionitem.completed_on is None
Example #4
0
 def test_update_form_kwargs_contain_prefix(self):
     updateview = EconsensusActionitemUpdateView()
     updateview.object = ActionItem(id=1)
     updateview.request = RequestFactory().get('/')
     updateview.kwargs = {'decisionpk': 1}
     form_kwargs = updateview.get_form_kwargs()
     assert 'prefix' in form_kwargs
     assert form_kwargs['prefix'] == "actionitem-1"
 def test_update_get_successurl(self):
     updateview = EconsensusActionitemUpdateView()
     updateview.object = ActionItem(id=1)
     updateview.kwargs = {'decisionpk': 1}
     assert updateview.get_success_url() == reverse('actionitem_detail',
                                                    kwargs={
                                                        'decisionpk': 1,
                                                        'pk': 1
                                                    })
 def test_title_2_with_long_description_with_default(self):
     description = random_string(1000)
     actionitem = ActionItem()
     actionitem.description = description
     assert actionitem.title() == description[:140]
 def test_title_1_with_short_description(self):
     description = random_string(30)
     actionitem = ActionItem()
     actionitem.description = description
     assert actionitem.title() == description
 def test_handle_done_4_with_done_set_false_removes_completed_on(self):
     # Completed on should be removed if done is false
     actionitem = ActionItem()
     actionitem.completed_on = random_date()
     actionitem = actionitem.handle_done(actionitem)
     assert actionitem.completed_on is None
 def test_handle_done_1_with_done_null(self):
     # With actionitem.done not set, completed on should be empty
     actionitem = ActionItem()
     actionitem = actionitem.handle_done(actionitem)
     assert actionitem.completed_on is None
 def test_signal_for_done_status_changed_not_sent_when_new_item_isnt_done(self, signal_sent):
     action_item = ActionItem(done=False)
     action_item.save()
     assert not signal_sent.send.called