use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.WorkloadPasswordPolicy in project cloudbreak by hortonworks.
the class MockUserManagementServiceTest method testGetAccountIncludesPasswordPolicy.
@Test
public void testGetAccountIncludesPasswordPolicy() throws IOException {
Path licenseFilePath = Files.createTempFile("license", "txt");
Files.writeString(licenseFilePath, VALID_LICENSE);
ReflectionTestUtils.setField(underTest, "cmLicenseFilePath", licenseFilePath.toString());
try {
underTest.init();
GetAccountRequest req = GetAccountRequest.getDefaultInstance();
StreamRecorder<GetAccountResponse> observer = StreamRecorder.create();
underTest.getAccount(req, observer);
assertThat(observer.getValues().size()).isEqualTo(1);
GetAccountResponse res = observer.getValues().get(0);
assertThat(res.hasAccount()).isTrue();
Account account = res.getAccount();
assertThat(account.hasGlobalPasswordPolicy()).isTrue();
WorkloadPasswordPolicy passwordPolicy = account.getGlobalPasswordPolicy();
assertThat(passwordPolicy.getWorkloadPasswordMaxLifetime()).isEqualTo(MockUserManagementService.PASSWORD_LIFETIME);
} finally {
Files.delete(licenseFilePath);
}
}
Aggregations