summaryrefslogtreecommitdiffstats
path: root/test/units/galaxy/test_collection.py
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2024-03-05 16:09:58 +0100
committerGitHub <noreply@github.com>2024-03-05 16:09:58 +0100
commitdd44449b6ec454a46426a020608fe3763287101f (patch)
treeae443de6bbe8cf165c8afb2dfcbbdf13b7d7fc0a /test/units/galaxy/test_collection.py
parentFollow fix for test_iptables (#82768) (diff)
downloadansible-dd44449b6ec454a46426a020608fe3763287101f.tar.xz
ansible-dd44449b6ec454a46426a020608fe3763287101f.zip
Use of constant for 644 permission variable (#82762)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'test/units/galaxy/test_collection.py')
-rw-r--r--test/units/galaxy/test_collection.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/units/galaxy/test_collection.py b/test/units/galaxy/test_collection.py
index 8dc109fffc..10bc0e5fbc 100644
--- a/test/units/galaxy/test_collection.py
+++ b/test/units/galaxy/test_collection.py
@@ -23,6 +23,7 @@ from ansible.cli.galaxy import GalaxyCLI
from ansible.errors import AnsibleError
from ansible.galaxy import api, collection, token
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
+from ansible.module_utils.common.file import S_IRWU_RG_RO
import builtins
from ansible.utils import context_objects as co
from ansible.utils.display import Display
@@ -78,7 +79,7 @@ def collection_artifact(monkeypatch, tmp_path_factory):
b_io = BytesIO(b"\x00\x01\x02\x03")
tar_info = tarfile.TarInfo('test')
tar_info.size = 4
- tar_info.mode = 0o0644
+ tar_info.mode = S_IRWU_RG_RO
tfile.addfile(tarinfo=tar_info, fileobj=b_io)
return input_file, mock_open
@@ -106,14 +107,14 @@ def tmp_tarfile(tmp_path_factory, manifest_info):
b_io = BytesIO(data)
tar_info = tarfile.TarInfo(filename)
tar_info.size = len(data)
- tar_info.mode = 0o0644
+ tar_info.mode = S_IRWU_RG_RO
tfile.addfile(tarinfo=tar_info, fileobj=b_io)
b_data = to_bytes(json.dumps(manifest_info, indent=True), errors='surrogate_or_strict')
b_io = BytesIO(b_data)
tar_info = tarfile.TarInfo('MANIFEST.json')
tar_info.size = len(b_data)
- tar_info.mode = 0o0644
+ tar_info.mode = S_IRWU_RG_RO
tfile.addfile(tarinfo=tar_info, fileobj=b_io)
sha256_hash = sha256()
@@ -962,7 +963,7 @@ def test_extract_tar_file_outside_dir(tmp_path_factory):
b_io = BytesIO(data)
tar_info = tarfile.TarInfo(tar_filename)
tar_info.size = len(data)
- tar_info.mode = 0o0644
+ tar_info.mode = S_IRWU_RG_RO
tfile.addfile(tarinfo=tar_info, fileobj=b_io)
expected = re.escape("Cannot extract tar entry '%s' as it will be placed outside the collection directory"