use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class DockerConfigReaderTest method testFromDockerConfig_IdentityToken.
@Test
public void testFromDockerConfig_IdentityToken() throws Exception {
final RegistryAuth authConfig = reader.fromFirstConfig(getTestFilePath("dockerConfig/identityTokenConfig.json"));
assertThat(authConfig, equalTo(IDENTITY_TOKEN_AUTH_CONFIG));
}
use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class DockerConfigReaderTest method testFromDockerConfig_CredsStore.
@Test
public void testFromDockerConfig_CredsStore() throws Exception {
assumeTrue("Need to have a credential store.", getAuthCredentialsExist());
String domain1 = "https://test.fakedomain.com";
String domain2 = "https://test.fakedomain2.com";
String testAuth1 = "{\n" + "\t\"ServerURL\": \"" + domain1 + "\",\n" + "\t\"Username\": \"david\",\n" + "\t\"Secret\": \"passw0rd1\"\n" + "}";
String testAuth2 = "{\n" + "\t\"ServerURL\": \"" + domain2 + "\",\n" + "\t\"Username\": \"carl\",\n" + "\t\"Secret\": \"myPassword\"\n" + "}";
storeAuthCredential(testAuth1);
storeAuthCredential(testAuth2);
final Path path = getTestFilePath("dockerConfig/" + getCredsStoreFileName());
final RegistryConfigs configs = reader.fromConfig(path);
for (RegistryAuth authConfigs : configs.configs().values()) {
if (domain1.equals(authConfigs.serverAddress())) {
assertThat(authConfigs.username(), equalTo("david"));
assertThat(authConfigs.password(), equalTo("passw0rd1"));
} else if (domain2.equals(authConfigs.serverAddress())) {
assertThat(authConfigs.username(), equalTo("carl"));
assertThat(authConfigs.password(), equalTo("myPassword"));
}
}
eraseAuthCredential(domain1);
eraseAuthCredential(domain2);
}
use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class DockerConfigReaderTest method testFromDockerConfig_MultiConfig.
@Test
public void testFromDockerConfig_MultiConfig() throws Exception {
final Path path = getTestFilePath("dockerConfig/multiConfig.json");
final RegistryAuth myDockParsed = reader.fromConfig(path, "https://narnia.mydock.io/v1/");
assertThat(myDockParsed, equalTo(MY_AUTH_CONFIG));
final RegistryAuth dockerIoParsed = reader.fromConfig(path, "https://index.docker.io/v1/");
assertThat(dockerIoParsed, equalTo(DOCKER_AUTH_CONFIG));
}
use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class DockerConfigReaderTest method testFromDockerConfig_WrongConfigs.
@Test
public void testFromDockerConfig_WrongConfigs() throws Exception {
final RegistryAuth registryAuth1 = reader.fromFirstConfig(getTestFilePath("dockerConfig/wrongConfig1.json"));
assertThat(registryAuth1, is(emptyRegistryAuth()));
final RegistryAuth registryAuth2 = reader.fromFirstConfig(getTestFilePath("dockerConfig/wrongConfig2.json"));
assertThat(registryAuth2, is(emptyRegistryAuth()));
}
use of com.spotify.docker.client.messages.RegistryAuth in project docker-client by spotify.
the class DockerConfigReaderTest method testFromDockerConfig_FullConfig.
@Test
public void testFromDockerConfig_FullConfig() throws Exception {
final RegistryAuth registryAuth = reader.fromFirstConfig(getTestFilePath("dockerConfig/fullConfig.json"));
assertThat(registryAuth, equalTo(DOCKER_AUTH_CONFIG));
}
Aggregations