mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Remove duplicated function(and pytest helper)
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
b104d98e90
commit
33925e7ad0
1 changed files with 1 additions and 13 deletions
|
@ -31,7 +31,7 @@ from saltfactories.utils import cli_scripts
|
|||
|
||||
import salt.utils.files
|
||||
from tests.conftest import CODE_DIR
|
||||
from tests.support.pytest.helpers import TestAccount
|
||||
from tests.support.pytest.helpers import TestAccount, download_file
|
||||
|
||||
ARTIFACTS_DIR = CODE_DIR / "artifacts" / "pkg"
|
||||
|
||||
|
@ -1494,15 +1494,3 @@ class ApiRequest:
|
|||
|
||||
def __exit__(self, *args):
|
||||
self.session.__exit__(*args)
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def download_file(url, dest, auth=None):
|
||||
# NOTE the stream=True parameter below
|
||||
with requests.get(url, stream=True, auth=auth) as r:
|
||||
r.raise_for_status()
|
||||
with salt.utils.files.fopen(dest, "wb") as f:
|
||||
for chunk in r.iter_content(chunk_size=8192):
|
||||
if chunk:
|
||||
f.write(chunk)
|
||||
return dest
|
||||
|
|
Loading…
Add table
Reference in a new issue