Skip to content

Commit 5a7dbae

Browse files
committed
Tests: Extract release data into constant
1 parent a3452fd commit 5a7dbae

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

tests/s3/test_s3_artifacts.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
from gardenlinux.s3.s3_artifacts import S3Artifacts
66

77
CNAME = "testcname"
8+
RELEASE_DATA = """
9+
GARDENLINUX_VERSION = 1234.1
10+
GARDENLINUX_COMMIT_ID = abc123
11+
GARDENLINUX_COMMIT_ID_LONG = abc123long
12+
GARDENLINUX_FEATURES = _usi,_trustedboot
13+
"""
814

915

1016
def test_s3artifacts_init_success(s3_setup):
@@ -68,15 +74,9 @@ def test_upload_from_directory_success(s3_setup):
6874
"""
6975
# Arrange
7076
s3, bucket_name, tmp_path = s3_setup
71-
release_data = """
72-
GARDENLINUX_VERSION = 1234.1
73-
GARDENLINUX_COMMIT_ID = abc123
74-
GARDENLINUX_COMMIT_ID_LONG = abc123long
75-
GARDENLINUX_FEATURES = _usi,_trustedboot
76-
"""
7777

7878
release_path = tmp_path / f"{CNAME}.release"
79-
release_path.write_text(release_data)
79+
release_path.write_text(RELEASE_DATA)
8080

8181
for filename in [f"{CNAME}-file1", f"{CNAME}-file2"]:
8282
(tmp_path / filename).write_bytes(b"dummy content")
@@ -103,12 +103,7 @@ def test_upload_from_directory_with_delete(s3_setup):
103103

104104
# Arrange: create release and artifact files locally
105105
release = tmp_path / f"{CNAME}.release"
106-
release.write_text(
107-
"GARDENLINUX_VERSION = 1234.1\n"
108-
"GARDENLINUX_COMMIT_ID = abc123\n"
109-
"GARDENLINUX_COMMIT_ID_LONG = abc123long\n"
110-
"GARDENLINUX_FEATURES = _usi,_trustedboot\n"
111-
)
106+
release.write_text(RELEASE_DATA)
112107

113108
artifact = tmp_path / f"{CNAME}.kernel"
114109
artifact.write_bytes(b"fake")

0 commit comments

Comments
 (0)