from azure.identity import DefaultAzureCredential
from savcfg.keyvault import KeyVaultReader


class A_KeyVaultReader:
    def should_list_variables(self):
        reader = KeyVaultReader(
            "savia-development", DefaultAzureCredential(), uppercase=True
        )

        assert "TEST.USER_NAME" in reader.list_vars()

    def should_read_variable(self):
        reader = KeyVaultReader(
            "savia-development", DefaultAzureCredential(), uppercase=True
        )

        assert reader.read("TEST.USER_NAME") == "test_name"
