[java-idp-plugin-webauthn] branch main updated: Add more tests

Phil Smart philip.smart at jisc.ac.uk
Thu Aug 1 10:23:21 UTC 2024


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-idp-plugin-webauthn.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-webauthn.git;a=commit;h=700c27ac7f3f6ba44af1d5d216d35cf77a542cc4

The following commit(s) were added to refs/heads/main by this push:
     new 700c27a  Add more tests
700c27a is described below

commit 700c27ac7f3f6ba44af1d5d216d35cf77a542cc4
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Thu Aug 1 11:23:19 2024 +0100

    Add more tests
---
 .../PopulateWebAuthnRegistrationContextTest.java   |  2 +-
 ...rationContextCredentialRemovalConsumerTest.java | 55 ++++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PopulateWebAuthnRegistrationContextTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PopulateWebAuthnRegistrationContextTest.java
index 02156d0..6f12568 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PopulateWebAuthnRegistrationContextTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/PopulateWebAuthnRegistrationContextTest.java
@@ -30,7 +30,7 @@ import net.shibboleth.shared.component.ComponentInitializationException;
 /**
  * Tests for {@link PopulateWebAuthnRegistrationContext}
  */
-public class PopulateWebAuthnRegistrationContextTest  extends AbstractWebAuthnTest {
+public class PopulateWebAuthnRegistrationContextTest extends AbstractWebAuthnTest {
     
     private PopulateWebAuthnRegistrationContext action;
     
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/RegistrationContextCredentialRemovalConsumerTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/RegistrationContextCredentialRemovalConsumerTest.java
new file mode 100644
index 0000000..5cee1f7
--- /dev/null
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/RegistrationContextCredentialRemovalConsumerTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.plugin.authn.webauthn.admin.impl;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
+import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
+import net.shibboleth.shared.component.ComponentInitializationException;
+
+/**
+ * Tests for {@link RegistrationContextCredentialRemovalConsumer}
+ */
+public class RegistrationContextCredentialRemovalConsumerTest extends AbstractWebAuthnTest {
+    
+    private RegistrationContextCredentialRemovalConsumer action;
+    
+    private WebAuthnRegistrationContext context;
+    
+    @Override
+    @BeforeMethod
+    public void setup() throws Exception {
+        super.setup();
+        action = new RegistrationContextCredentialRemovalConsumer();
+        action.setId("consumer");
+        context = addWebAuthnRegistrationContext();
+    }
+    
+    @Test
+    public void testCredentialRemoval() throws ComponentInitializationException {
+        action.initialize();
+        
+        final byte[] credId = generateRandomBytes(16);
+        action.accept(prc, credId);
+        assertNotNull(context.getCredentialIdToRemove());
+        assertEquals(context.getCredentialIdToRemove(), credId);
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list