# Path: rebasehelper/constants.py
# ENCODING: str = locale.getpreferredencoding()
# 
# Path: rebasehelper/helpers/download_helper.py
# class DownloadHelper:
#         class FTPAdapter(requests.adapters.BaseAdapter):
#     def progress(download_total, downloaded, start_time, show_size=True):
#         def format_time(t):
#         def format_size(s):
#     def request(url, **kwargs):
#             def send(self, request, stream=False, timeout=None, verify=True,  # pylint: disable=unused-argument
#                      cert=None, proxies=None):  # pylint: disable=unused-argument
#             def close(self):
#     def download_file(url, destination_path, blocksize=8192):


import io
import os
import pytest  # type: ignore
from rebasehelper.constants import ENCODING
from rebasehelper.helpers.download_helper import DownloadHelper, DownloadError
    ], ids=[
        'HTTP',
        'HTTPS',
        'FTP',
        'HTTP-unknown_size',
        'HTTPS-unknown_size',
        'FTP-unknown_size',
    ])
    @pytest.mark.integration
    def test_download_existing_file(self, url, content):
        """Test downloading existing file"""
        local_file = 'local_file'
        DownloadHelper.download_file(url, local_file)
        assert os.path.isfile(local_file)
        with open(local_file, encoding=ENCODING) as f:
            assert f.readline().strip() == content

    @pytest.mark.parametrize('url', [
        'http://integration:8000/non_existing_file.txt',
        'https://integration:4430/non_existing_file.txt',
        'ftp://integration:2100/non_existing_file.txt',
    ], ids=[
        'HTTP',
        'HTTPS',
        'FTP',
    ])
    @pytest.mark.integration
    def test_download_non_existing_file(self, url):
        """Test downloading NON existing file"""
        local_file = 'local_file'

# Path: rebasehelper/constants.py
# ENCODING: str = locale.getpreferredencoding()
# 
# Path: rebasehelper/helpers/download_helper.py
# class DownloadHelper:
#         class FTPAdapter(requests.adapters.BaseAdapter):
#     def progress(download_total, downloaded, start_time, show_size=True):
#         def format_time(t):
#         def format_size(s):
#     def request(url, **kwargs):
#             def send(self, request, stream=False, timeout=None, verify=True,  # pylint: disable=unused-argument
#                      cert=None, proxies=None):  # pylint: disable=unused-argument
#             def close(self):
#     def download_file(url, destination_path, blocksize=8192):


# Path: rebasehelper/tests/helpers/test_download_helper.py
import io
import os
import pytest  # type: ignore
from rebasehelper.constants import ENCODING
from rebasehelper.helpers.download_helper import DownloadHelper, DownloadError

    ], ids=[
        'HTTP',
        'HTTPS',
        'FTP',
        'HTTP-unknown_size',
        'HTTPS-unknown_size',
        'FTP-unknown_size',
    ])
    @pytest.mark.integration
    def test_download_existing_file(self, url, content):
        """Test downloading existing file"""
        local_file = 'local_file'
        DownloadHelper.download_file(url, local_file)
        assert os.path.isfile(local_file)
        with open(local_file, encoding=ENCODING) as f:
            assert f.readline().strip() == content

    @pytest.mark.parametrize('url', [
        'http://integration:8000/non_existing_file.txt',
        'https://integration:4430/non_existing_file.txt',
        'ftp://integration:2100/non_existing_file.txt',
    ], ids=[
        'HTTP',
        'HTTPS',
        'FTP',
    ])
    @pytest.mark.integration
    def test_download_non_existing_file(self, url):
        """Test downloading NON existing file"""
        local_file = 'local_file'

        with pytest.raises(DownloadError):