示例#1
0
    def test_execute_and_wait(self):
        query = Notebook()

        query.execute = Mock(return_value={'history_uuid': 1, 'status': 0})
        query.check_status = Mock(side_effect=check_status_side_effect)
        request = Mock()

        resp = query.execute_and_wait(request=request)
        assert_equal(1, resp['history_uuid'])
        assert_equal(2, query.check_status.call_count)
示例#2
0
    def test_execute_and_wait(self):
        query = Notebook()

        query.execute = Mock(return_value={'history_uuid': 1, 'status': 0})
        query.check_status = Mock(side_effect=check_status_side_effect)
        query.fetch_result_data = Mock(return_value={'results': [[1], [2]]})
        request = Mock()

        resp = query.execute_and_wait(request=request, include_results=True)

        assert_equal(0, resp.get('status'), resp)
        assert_equal('available', resp['query_status']['status'], resp)
        assert_equal([[1], [2]], resp.get('results'), resp)

        assert_equal(2, query.check_status.call_count)