##// END OF EJS Templates
chore: fixed merge conflicts
chore: fixed merge conflicts

File last commit:

r5516:3496180b default
r5546:50cf7822 merge v5.2.0 stable
Show More
__init__.py
56 lines | 1.9 KiB | text/x-python | PythonLexer
copyrights: updated for 2023
r5088 # Copyright (C) 2016-2023 RhodeCode GmbH
file-store: rename module from upload_store to file_store.
r3453 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516 import os
import random
import tempfile
import string
import pytest
from rhodecode.apps.file_store import utils as store_utils
@pytest.fixture()
def file_store_instance(ini_settings):
config = ini_settings
f_store = store_utils.get_filestore_backend(config=config, always_init=True)
return f_store
@pytest.fixture
def random_binary_file():
# Generate random binary data
data = bytearray(random.getrandbits(8) for _ in range(1024 * 512)) # 512 KB of random data
# Create a temporary file
temp_file = tempfile.NamedTemporaryFile(delete=False)
filename = temp_file.name
try:
# Write the random binary data to the file
temp_file.write(data)
temp_file.seek(0) # Rewind the file pointer to the beginning
yield filename, temp_file
finally:
# Close and delete the temporary file after the test
temp_file.close()
os.remove(filename)
def generate_random_filename(length=10):
return ''.join(random.choices(string.ascii_letters + string.digits, k=length))