def test_get_secret_domain(self, secrets): a, b, c, d = [secrets[x] for x in sorted(secrets)] assert SecretUtils.get_secret_domain(a) == "1.example.com" assert SecretUtils.get_secret_domain(b) == "2.example.com" assert SecretUtils.get_secret_domain(c) == "2.example.com" assert SecretUtils.get_secret_domain(d) is None
def get_all_names(self): # type: () -> List[str] """Get all domain names that have at least one existing secret. :rtype: Set[str] """ f = {} f[SecretUtils.L_MANAGED] = lambda x: x == "true" f[SecretUtils.L_DOMAIN] = lambda x: x is not None f[SecretUtils.L_NAME] = lambda x: x is not None f[SecretUtils.L_VERSION] = lambda x: x is not None f[SecretUtils.L_FINGERPRINT] = lambda x: x is not None s = self.docker_client.secrets.list() s = SecretUtils.filter_secrets(s, f) return {SecretUtils.get_secret_domain(x) for x in s}