Search in sources :

Example 1 with Scalar

use of com.amihaiemil.eoyaml.Scalar in project artipie by artipie.

the class UsersFromStorageYamlTest method readsCredentialsFromCache.

@Test
void readsCredentialsFromCache() {
    final CachedCreds cache = new CachedCreds();
    new TestResource("_credentials.yaml").saveTo(this.storage, this.key);
    final UsersFromStorageYaml creds = new UsersFromStorageYaml(this.storage, this.key, cache);
    creds.yaml().toCompletableFuture().join();
    this.saveCreds(Users.PasswordFormat.PLAIN, Pair.of(new Users.User("pol"), "newpswd"));
    MatcherAssert.assertThat(creds.yaml().toCompletableFuture().join().yamlMapping("credentials").keys().stream().map(YamlNode::asScalar).map(Scalar::value).toList(), Matchers.containsInAnyOrder("bob", "alice"));
}
Also used : TestResource(com.artipie.asto.test.TestResource) CachedCreds(com.artipie.cache.CachedCreds) Scalar(com.amihaiemil.eoyaml.Scalar) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Scalar (com.amihaiemil.eoyaml.Scalar)1 TestResource (com.artipie.asto.test.TestResource)1 CachedCreds (com.artipie.cache.CachedCreds)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1