Exemplo n.º 1
0
def wait_for_task(task_id, app):
    while True:
        resp = app.get('/task/{}'.format(task_id))

        if resp.json['status'] == 'success':
            return True
        elif resp.json['status'] == 'failure':
            return False

        time.sleep(0.01)
Exemplo n.º 2
0
def wait_for_task(task_id, app):
    while True:
        resp = app.get('/task/{}'.format(task_id))

        if resp.json['status'] == 'success':
            return True
        elif resp.json['status'] == 'failure':
            return False

        time.sleep(0.01)
Exemplo n.º 3
0
def test_long_running(app):
    resp = app.post_json('/test/long_running', {'message': 'Test message!'})

    task_id = resp.json['task_id']

    results = set()

    start_time = time.time()
    while time.time() - start_time < 15:
        resp = app.get('/task/{}'.format(task_id))
        results.add(resp.body)
        time.sleep(0.1)

    assert len(results) == 11
Exemplo n.º 4
0
def test_long_running(app):
    resp = app.post_json(
        '/test/long_running',
        {'message': 'Test message!'})

    task_id = resp.json['task_id']

    results = set()

    start_time = time.time()
    while time.time() - start_time < 15:
        resp = app.get('/task/{}'.format(task_id))
        results.add(resp.body)
        time.sleep(0.1)

    assert len(results) == 11
Exemplo n.º 5
0
    def test_long_running(self):
        with traad.app.bind_to_project('.') as traad_app:
            app = webtest.TestApp(traad_app)

            resp = app.post_json('/test/long_running',
                                 {'message': 'Test message!'})

            task_id = resp.json['task_id']

            results = set()

            start_time = time.time()
            while time.time() - start_time < 15:
                resp = app.get('/task/{}'.format(task_id))
                results.add(resp.body)
                time.sleep(0.1)

            self.assertEqual(len(results), 11)
Exemplo n.º 6
0
    def test_long_running(self):
        with traad.app.bind_to_project('.') as traad_app:
            app = webtest.TestApp(traad_app)

            resp = app.post_json(
                '/test/long_running',
                {'message': 'Test message!'})

            task_id = resp.json['task_id']

            results = set()

            start_time = time.time()
            while time.time() - start_time < 15:
                resp = app.get('/task/{}'.format(task_id))
                results.add(resp.body)
                time.sleep(0.1)

            self.assertEqual(len(results), 11)