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