Esempio n. 1
0
    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
Esempio n. 2
0
 def test_is_final(self, state, expected):
     result = ResultState(mock.Mock(spec=AsyncResult))
     result.state = state
     assert result.is_final() == expected
Esempio n. 3
0
 def test_needs_reschedule(self, state, expected):
     result = ResultState(mock.Mock(spec=AsyncResult))
     result.state = state
     assert result.needs_reschedule() == expected
Esempio n. 4
0
 def test_was_published(self, state, expected):
     result = ResultState(mock.Mock(spec=AsyncResult))
     result.state = state
     assert result.was_published() == expected
Esempio n. 5
0
 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
Esempio n. 6
0
 def test_is_successful(self, success):
     res = mock.Mock(spec=AsyncResult)
     result = ResultState(res)
     result.success = success
     assert result.is_successful() == success
Esempio n. 7
0
 def test_success(self):
     res = mock.Mock(spec=AsyncResult)
     result = ResultState(res)
     assert result.success == res.successful()