Skip to content

Commit 1c58f8d

Browse files
committed
more tests
1 parent 54a2f5d commit 1c58f8d

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

tests/github/test_release_page.py

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,52 @@ def test_download_metadata_file(downloads_dir):
8585
GARDENLINUX_RELEASE,
8686
GARDENLINUX_COMMIT_SHORT,
8787
S3_DOWNLOADS_DIR)
88-
os.path.isfile(S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml")
88+
assert (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml").exists()
8989

9090

91-
def test_github_release_page(monkeypatch):
91+
def test_download_metadata_file_no_such_release(downloads_dir):
92+
s3_artifacts = S3Artifacts(GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME)
93+
release = "0000.0"
94+
commit = GARDENLINUX_COMMIT_SHORT
95+
cname = CName("aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit))
96+
with pytest.raises(IndexError):
97+
download_metadata_file(s3_artifacts,
98+
cname.cname,
99+
release,
100+
commit,
101+
S3_DOWNLOADS_DIR)
102+
assert not (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml").exists()
103+
104+
105+
def test_download_metadata_file_no_such_commit(downloads_dir):
106+
s3_artifacts = S3Artifacts(GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME)
107+
release = GARDENLINUX_RELEASE
108+
commit = "deadbeef"
109+
cname = CName("aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit))
110+
with pytest.raises(IndexError):
111+
download_metadata_file(s3_artifacts,
112+
cname.cname,
113+
release,
114+
commit,
115+
S3_DOWNLOADS_DIR)
116+
assert not (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml").exists()
117+
118+
119+
def test_download_metadata_file_no_such_release_and_commit(downloads_dir):
120+
s3_artifacts = S3Artifacts(GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME)
121+
release = "0000.0"
122+
commit = "deadbeef"
123+
cname = CName("aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit))
124+
with pytest.raises(IndexError):
125+
download_metadata_file(s3_artifacts,
126+
cname.cname,
127+
release,
128+
commit,
129+
S3_DOWNLOADS_DIR)
130+
assert not (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml").exists()
131+
132+
133+
def test_github_release_page(monkeypatch, downloads_dir):
92134
monkeypatch.setattr("gardenlinux.github.__main__.Repo", SubmoduleAsRepo)
93135
import gardenlinux.github
94136

0 commit comments

Comments
 (0)