def test_run(fs_mock, ts_mock, yt_mock, tmp_path, fix_run_tasks, fix_run_results, fix_auth_token,
             fix_yt_empty_resp, fix_yt_valid_resp):

    fs_mock.side_effect = ['19800101_000000', '19800101_010000']
    ts_mock.return_value = '1980-01-01T00:00:00Z'
    yt_mock.side_effect = [fix_yt_empty_resp, fix_yt_empty_resp, fix_yt_valid_resp,
                           fix_yt_valid_resp]

    dir_work_data = tmp_path / 'data'
    dir_work_data.mkdir()

    config = {
        'api_poll_int': 0,
        'dir_work_data': dir_work_data,
        'file_task_queue': tmp_path / 'task.queue',
        'file_token': tmp_path / 'token.pkl'
        }

    with config['file_token'].open('wb') as fd_out:
        pickle.dump(fix_auth_token, fd_out)

    with patch.dict(settings.config, config):
        api.run(fix_run_tasks)

        results = []
        with config['file_task_queue'].open() as fd_in:
            for line in fd_in:
                results.append(json.loads(line))


        assert fix_run_results == results
        assert (config['dir_work_data'] / '19800101_000000_result.json').is_file()
        assert (config['dir_work_data'] / '19800101_010000_result.json').is_file()
Esempio n. 2
0
#!python
from app import api

if __name__ == '__main__':
    api.run()

Esempio n. 3
0
File: run.py Progetto: yudori/tariff
from app import api

if __name__ == '__main__':
    api.run(debug=True)

Esempio n. 4
0
from app import api

if __name__ == '__main__':
    api.run(host="localhost", port=9000, debug=True)
Esempio n. 5
0
#!/usr/bin/env python
from app import api

if __name__ == '__main__':
    api.run(host='0.0.0.0', port=5000, debug=True)
Esempio n. 6
0
# -*- coding: utf-8 -*-

from app import api

if __name__ == '__main__':
    api.run()
Esempio n. 7
0
#!.env/bin/python
import os

from app import api

if __name__ == "__main__":
    api.run(host="0.0.0.0", port=5580, debug=True)
Esempio n. 8
0
__author__ = 'Xiongc2'
#!bin/python3.6
from app import api, blueprint

if __name__ == '__main__':
    api.run(host='127.0.0.1', port=80, debug=True, threaded=True)