use of com.microsoft.azure.management.containerregistry.RegistryCredentials in project azure-tools-for-java by Microsoft.
the class ContainerRegistryMvpModelTest method testCreateImageSettingWithRegistry.
@Test
public void testCreateImageSettingWithRegistry() throws Exception {
when(registryMock1.adminUserEnabled()).thenReturn(true);
RegistryCredentials credentials = mock(RegistryCredentials.class);
when(registryMock1.getCredentials()).thenReturn(credentials);
when(registryMock1.loginServerUrl()).thenReturn("url");
when(credentials.username()).thenReturn("Alice");
Map<AccessKeyType, String> passwords = new HashMap<>();
passwords.put(AccessKeyType.PRIMARY, "primaryKey");
when(credentials.accessKeys()).thenReturn(passwords);
PrivateRegistryImageSetting setting = containerRegistryMvpModel.createImageSettingWithRegistry(registryMock1);
assertEquals(setting.getUsername(), "Alice");
assertEquals(setting.getPassword(), "primaryKey");
assertEquals(setting.getServerUrl(), "url");
assertEquals(setting.getImageNameWithTag(), "image:tag");
}
Aggregations