curl: rename "transform" to "amend_secrets"
The curl source is the only source left that uses "transform". And here the name is very generic but in fact we only do a single thing: we add secrets for subscriptions for for mtls to the download. So rename to make it clear what this is all about.
This commit is contained in:
parent
1fc7ead2f4
commit
352bf5cd52
2 changed files with 17 additions and 16 deletions
|
|
@ -36,7 +36,7 @@ def test_curl_source_exists(sources_module):
|
|||
assert curl_source.exists(checksum, desc)
|
||||
|
||||
|
||||
def test_curl_source_transform(sources_module):
|
||||
def test_curl_source_amend_secrets(sources_module):
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
curl_source = sources_module.CurlSource.from_args(["--service-fd", str(sock.fileno())])
|
||||
tmpdir = tempfile.TemporaryDirectory()
|
||||
|
|
@ -58,13 +58,13 @@ def test_curl_source_transform(sources_module):
|
|||
cm.callback(cb)
|
||||
checksum = "sha256:1234567890123456789012345678901234567890909b14ffb032aa20fa23d9ad6"
|
||||
pathlib.Path(os.path.join(tmpdir.name, checksum)).touch()
|
||||
new_desc = curl_source.transform(checksum, desc)
|
||||
new_desc = curl_source.amend_secrets(checksum, desc)
|
||||
assert new_desc[1]["secrets"]["ssl_client_key"] == "key"
|
||||
assert new_desc[1]["secrets"]["ssl_client_cert"] == "cert"
|
||||
assert new_desc[1]["secrets"]["ssl_ca_cert"] is None
|
||||
|
||||
|
||||
def test_curl_source_transform_fail(sources_module):
|
||||
def test_curl_source_amend_secrets_fail(sources_module):
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
curl_source = sources_module.CurlSource.from_args(["--service-fd", str(sock.fileno())])
|
||||
tmpdir = tempfile.TemporaryDirectory()
|
||||
|
|
@ -78,5 +78,5 @@ def test_curl_source_transform_fail(sources_module):
|
|||
checksum = "sha256:1234567890123456789012345678901234567890909b14ffb032aa20fa23d9ad6"
|
||||
pathlib.Path(os.path.join(tmpdir.name, checksum)).touch()
|
||||
with pytest.raises(RuntimeError) as exc:
|
||||
curl_source.transform(checksum, desc)
|
||||
curl_source.amend_secrets(checksum, desc)
|
||||
assert "mtls secrets required" in str(exc)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue