|
9 | 9 | import java.util.Map; |
10 | 10 | import java.util.stream.Collectors; |
11 | 11 | import javax.naming.NamingException; |
| 12 | + |
| 13 | +import org.junit.jupiter.api.Disabled; |
12 | 14 | import org.junit.jupiter.api.Tag; |
13 | 15 | import org.junit.jupiter.api.Test; |
14 | 16 | import org.slf4j.Logger; |
15 | 17 | import org.slf4j.LoggerFactory; |
16 | 18 | import static org.junit.jupiter.api.Assertions.assertEquals; |
17 | 19 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 20 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
18 | 21 |
|
19 | 22 |
|
20 | 23 | class SkLdapTest { |
21 | 24 | private static final Logger log = LoggerFactory.getLogger(SkLdapTest.class); |
22 | 25 |
|
23 | | - // Igor cert is not available from SKs |
24 | | - //private static final String id = "37101010021";//Igor |
| 26 | + @Test |
| 27 | + @Tag("ldap") |
| 28 | + void shouldFailToFindMissingAuthenticationCert() { |
| 29 | + // JAAK-KRISTJAN JÕEORG 38001085718 cert is not available from SK Ldap as he is a test |
| 30 | + // person and SK doesn't have test LDAP environment. |
| 31 | + String[] ids = new String[]{"38001085718"}; |
| 32 | + assertThrows(CertificateException.class, () -> SkLdapUtil.getPublicKeysWithLabels(ids)); |
| 33 | + } |
25 | 34 |
|
26 | 35 | @Test |
27 | 36 | @Tag("ldap") |
| 37 | + @Disabled("Requires real ID code. As 38001085718 code is for test person - its certificate" |
| 38 | + + " is not available from SK LDAP. Needs to be run separately from other LDAP tests" |
| 39 | + + " with own ID code") |
28 | 40 | void testFindAuthenticationCerts() throws NamingException, CertificateException { |
29 | | - String[] ids = new String[]{"37903130370", "38207162766"}; |
| 41 | + String[] ids = new String[]{"38001085718"}; // replace with own ID code for testing |
30 | 42 | List<SkLdapUtil.CertificateData> keysWithLabels = SkLdapUtil.getPublicKeysWithLabels(ids); |
31 | 43 |
|
32 | 44 | // Since testing against external service, then can't be really sure what is returned |
|
0 commit comments