def test_state(self, res_state, res_val, ready, expected): res = mock.Mock(spec=AsyncResult) res.state = res_state res.ready.return_value = ready res.result = res_val result = ResultState(res) assert result.state == expected
def test_is_final(self, state, expected): result = ResultState(mock.Mock(spec=AsyncResult)) result.state = state assert result.is_final() == expected
def test_needs_reschedule(self, state, expected): result = ResultState(mock.Mock(spec=AsyncResult)) result.state = state assert result.needs_reschedule() == expected
def test_was_published(self, state, expected): result = ResultState(mock.Mock(spec=AsyncResult)) result.state = state assert result.was_published() == expected
def test_is_done(self, ready, expected): res = mock.Mock(spec=AsyncResult) res.ready.return_value = ready res.state = 'DUMMY' result = ResultState(res) assert result.is_done() == expected
def test_is_successful(self, success): res = mock.Mock(spec=AsyncResult) result = ResultState(res) result.success = success assert result.is_successful() == success
def test_success(self): res = mock.Mock(spec=AsyncResult) result = ResultState(res) assert result.success == res.successful()