Exemple #1
0
async def test_fetch_secrets_managed(Secrets):
    "Only managed secrets are returned"
    with test_options(with_secrets=True):
        Secrets.secrets.append({"name": "secret1", "secret": "AA"})
        Secrets.secrets.append({"name": "unmanaged-secret2"})
        resources = Resources([], ["Secret=secret"])
        await fetch_secrets(resources)
        assert list(sorted(resources)) == [Secret(name="secret1", secret="AA")]
Exemple #2
0
async def test_fetch_secrets_with_secrets(Secrets):
    "When there are secrets and --with-secrets, we get names and values"
    with test_options(with_secrets=True):
        Secrets.secrets.append({"name": "secret1", "secret": "AA"})
        Secrets.secrets.append({"name": "secret2", "secret": "BB"})
        resources = Resources([], [".*"])
        await fetch_secrets(resources)
        assert list(sorted(resources)) == [
            Secret(name="secret1", secret="AA"),
            Secret(name="secret2", secret="BB"),
        ]
Exemple #3
0
async def test_fetch_secrets_without_secrets(Secrets):
    "When there are secrets but --without-secrets, we just get names"
    with test_options(with_secrets=False):
        Secrets.secrets.append({"name": "secret1"})
        Secrets.secrets.append({"name": "secret2"})
        resources = Resources([], [".*"])
        await fetch_secrets(resources)
        assert list(sorted(resources)) == [
            Secret(name="secret1"),
            Secret(name="secret2"),
        ]
Exemple #4
0
async def test_fetch_secrets_empty(Secrets):
    "When there are no secrets, nothing happens"
    with test_options(with_secrets=True):
        resources = Resources([], [".*"])
        await fetch_secrets(resources)
        assert list(resources) == []