This is an automated email from the ASF dual-hosted git repository.
lprimak pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/3.x by this push:
new 3fd6590e1 bugfix(test): fix tests broken in
5ed1ffa0594cf66dc82cc3a2d735343ab956a9ce
3fd6590e1 is described below
commit 3fd6590e1ac255065189179f5f07fb36c070a3b6
Author: lprimak <[email protected]>
AuthorDate: Mon Jan 19 14:12:28 2026 -0600
bugfix(test): fix tests broken in 5ed1ffa0594cf66dc82cc3a2d735343ab956a9ce
---
.../web/filter/authc/BearerHttpFilterAuthenticationTest.groovy | 10 +++++-----
.../web/filter/authc/BasicHttpFilterAuthenticationTest.java | 1 +
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git
a/web/src/test/groovy/org/apache/shiro/web/filter/authc/BearerHttpFilterAuthenticationTest.groovy
b/web/src/test/groovy/org/apache/shiro/web/filter/authc/BearerHttpFilterAuthenticationTest.groovy
index 0c94f6557..997f39ec9 100644
---
a/web/src/test/groovy/org/apache/shiro/web/filter/authc/BearerHttpFilterAuthenticationTest.groovy
+++
b/web/src/test/groovy/org/apache/shiro/web/filter/authc/BearerHttpFilterAuthenticationTest.groovy
@@ -108,7 +108,7 @@ class BearerHttpFilterAuthenticationTest extends
SecurityManagerTestSupport {
BearerHttpAuthenticationFilter testFilter = new
BearerHttpAuthenticationFilter()
HttpServletRequest request = createMock(HttpServletRequest.class)
- expect(request.getMethod()).andReturn("GET")
+ expect(request.getMethod()).andReturn("GET").times(2)
replay(request)
HttpServletResponse response = createMock(HttpServletResponse.class)
@@ -127,7 +127,7 @@ class BearerHttpFilterAuthenticationTest extends
SecurityManagerTestSupport {
BearerHttpAuthenticationFilter testFilter = new
BearerHttpAuthenticationFilter()
HttpServletRequest request = mockRequest("valid-token", "localhost", {
- expect(it.getMethod()).andReturn("POST")
+ expect(it.getMethod()).andReturn("POST").times(2)
})
HttpServletResponse response = mockResponse()
@@ -181,7 +181,7 @@ class BearerHttpFilterAuthenticationTest extends
SecurityManagerTestSupport {
BearerHttpAuthenticationFilter testFilter = new
BearerHttpAuthenticationFilter()
HttpServletRequest request = mockRequest("valid-token", "localhost", {
- expect(it.getMethod()).andReturn("GET")
+ expect(it.getMethod()).andReturn("GET").times(2)
})
HttpServletResponse response = mockResponse()
@@ -199,7 +199,7 @@ class BearerHttpFilterAuthenticationTest extends
SecurityManagerTestSupport {
HttpServletRequest request = createMock(HttpServletRequest.class)
expect(request.getHeader("Authorization")).andReturn(null)
- expect(request.getMethod()).andReturn("GET")
+ expect(request.getMethod()).andReturn("GET").times(2)
expect(request.getRemoteHost()).andReturn("localhost")
replay(request)
@@ -217,7 +217,7 @@ class BearerHttpFilterAuthenticationTest extends
SecurityManagerTestSupport {
BearerHttpAuthenticationFilter testFilter = new
BearerHttpAuthenticationFilter()
HttpServletRequest request = mockRequest("a-valid-token", "localhost",
{
- expect(it.getMethod()).andReturn("POST")
+ expect(it.getMethod()).andReturn("POST").times(2)
})
HttpServletResponse response = mockResponse()
diff --git
a/web/src/test/java/org/apache/shiro/web/filter/authc/BasicHttpFilterAuthenticationTest.java
b/web/src/test/java/org/apache/shiro/web/filter/authc/BasicHttpFilterAuthenticationTest.java
index 69d2b5831..3efce20bd 100644
---
a/web/src/test/java/org/apache/shiro/web/filter/authc/BasicHttpFilterAuthenticationTest.java
+++
b/web/src/test/java/org/apache/shiro/web/filter/authc/BasicHttpFilterAuthenticationTest.java
@@ -311,6 +311,7 @@ public class BasicHttpFilterAuthenticationTest extends
SecurityManagerTestSuppor
@Test
public void notAllowedPreFlightRequests() {
testFilter = new BasicHttpAuthenticationFilter();
+ testFilter.setAllowPreFlightRequests(false);
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);