|
6 | 6 | from docker.models.containers import Container
|
7 | 7 | import chromedriver_autoinstaller
|
8 | 8 | from docker import DockerClient
|
| 9 | +from moto import mock_aws |
9 | 10 |
|
10 | 11 | from ci.ci import CI, SetEnvs
|
11 | 12 |
|
12 |
| -os.environ["DRY_RUN"] = "true" |
| 13 | +os.environ["DRY_RUN"] = "false" |
13 | 14 | os.environ["IMAGE"] = "linuxserver/test"
|
14 | 15 | os.environ["BASE"] = "alpine"
|
15 | 16 | os.environ["ACCESS_KEY"] = "secret-access-key"
|
16 | 17 | os.environ["SECRET_KEY"] = "secret-key"
|
17 | 18 | os.environ["META_TAG"] = "test-meta-tag"
|
18 | 19 | os.environ["TAGS"] = "amd64-nightly-5.10.1.9109-ls85|arm64v8-nightly-5.10.1.9109-ls85"
|
19 |
| -os.environ["CI_LOG_LEVEL"] = "DEBUG" |
| 20 | +os.environ["CI_LOG_LEVEL"] = "ERROR" |
20 | 21 | os.environ["NODE_NAME"] = "test-node"
|
21 | 22 | os.environ["SSL"] = "true"
|
22 | 23 | os.environ["PORT"] = "443"
|
@@ -159,3 +160,17 @@ def test_badge_render(ci:CI):
|
159 | 160 | def test_generate_sbom(ci:CI, syft_mock_container:Mock, sbom_blob:bytes):
|
160 | 161 | sbom = ci.generate_sbom(ci.tags[0])
|
161 | 162 | assert "VERSION" in sbom
|
| 163 | + |
| 164 | +def test_create_s3_client(ci:CI): |
| 165 | + with mock_aws(): |
| 166 | + ci.s3_client = ci.create_s3_client() |
| 167 | + assert ci.s3_client is not None |
| 168 | + |
| 169 | +def test_upload_file(ci: CI) -> None: |
| 170 | + with mock_aws(): |
| 171 | + # Create the mock S3 client |
| 172 | + ci.s3_client = ci.create_s3_client() |
| 173 | + # Create the bucket |
| 174 | + ci.s3_client.create_bucket(Bucket=ci.bucket) |
| 175 | + # Upload a file to the bucket |
| 176 | + ci.upload_file("tests/log_blob.log", "log_blob.log", {"ContentType": "text/plain", "ACL": "public-read"}) |
0 commit comments