def test_markers_and_context_complete(self, mark, context_from_id, check_markers): """Ensure if all markers are complete that True is returned and nothing else is done. """ async = Async('foo') async.update_options(context_id='contextid') complete_event = Mock() context = Context(id="contextid", callbacks={'complete': complete_event}) context_from_id.return_value = context marker = FuriousCompletionMarker(id="contextid", complete=True) marker.put() check_markers.return_value = True, False mark.return_value = True result = _completion_checker(async.id, async.context_id) self.assertTrue(result) self.assertFalse(complete_event.start.called) marker.key.delete()
def test_markers_and_context_complete(self, mark, context_from_id, check_markers): """Ensure if all markers are complete that True is returned and nothing else is done. """ async = Async('foo') async .update_options(context_id='contextid') complete_event = Mock() context = Context(id="contextid", callbacks={'complete': complete_event}) context_from_id.return_value = context marker = FuriousCompletionMarker(id="contextid", complete=True) marker.put() check_markers.return_value = True, False mark.return_value = True result = _completion_checker(async .id, async .context_id) self.assertTrue(result) self.assertFalse(complete_event.start.called) marker.key.delete()
def test_has_errors_with_marker_cached(self): """Ensure returns the value from the marker when cached.""" context_id = 1 marker = FuriousCompletionMarker(id=context_id, has_errors=True) marker.put() context = Context(id=context_id) context._marker = marker context_result = ContextResult(context) self.assertIsNone(context_result._marker) self.assertTrue(context_result.has_errors()) marker.key.delete()