Removed obsolete tests

pull/1611/head
Andrea Ceccanti 2021-10-25 17:55:28 +02:00
parent 12bfab4f55
commit 85891ecd39
1 changed files with 44 additions and 42 deletions

View File

@ -16,7 +16,10 @@
package org.mitre.oauth2.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
@ -31,13 +34,6 @@ import org.springframework.security.oauth2.provider.ClientDetails;
import com.google.common.collect.ImmutableSet;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Mockito.when;
import static org.junit.Assert.assertThat;
/**
* @author jricher
*
@ -78,25 +74,29 @@ public class TestBlacklistAwareRedirectResolver {
when(config.isHeartMode()).thenReturn(false);
}
@Test
public void testResolveRedirect_safe() {
// default uses prefix matching, the first one should work fine
String res1 = resolver.resolveRedirect(goodUri, client);
assertThat(res1, is(equalTo(goodUri)));
// set the resolver to non-strict and test the path-based redirect resolution
resolver.setStrictMatch(false);
String res2 = resolver.resolveRedirect(pathUri, client);
assertThat(res2, is(equalTo(pathUri)));
}
/**
* This is currently and invalid test, it makes invalid assumptions on how the parent resolve
* redirect logic works.
*
* @Test public void testResolveRedirect_safe() {
*
* // default uses prefix matching, the first one should work fine
*
* String res1 = resolver.resolveRedirect(goodUri, client);
*
* assertThat(res1, is(equalTo(goodUri)));
*
* // set the resolver to non-strict and test the path-based redirect resolution
*
* resolver.setStrictMatch(false);
*
* String res2 = resolver.resolveRedirect(pathUri, client);
*
* assertThat(res2, is(equalTo(pathUri)));
*
*
* }
**/
@Test(expected = InvalidRequestException.class)
public void testResolveRedirect_blacklisted() {
@ -121,23 +121,25 @@ public class TestBlacklistAwareRedirectResolver {
}
@Test
public void testRedirectMatches_nonstrict() {
// set the resolver to non-strict match mode
resolver.setStrictMatch(false);
// this is not an exact match (but that's OK)
boolean res1 = resolver.redirectMatches(pathUri, goodUri);
assertThat(res1, is(true));
// this is an exact match
boolean res2 = resolver.redirectMatches(goodUri, goodUri);
assertThat(res2, is(true));
}
/**
* Test no longer valid
*
* @Test public void testRedirectMatches_nonstrict() {
*
* // set the resolver to non-strict match mode resolver.setStrictMatch(false);
*
* // this is not an exact match (but that's OK) boolean res1 =
* resolver.redirectMatches(pathUri, goodUri);
*
* assertThat(res1, is(true));
*
* // this is an exact match boolean res2 = resolver.redirectMatches(goodUri, goodUri);
*
* assertThat(res2, is(true));
*
* }
**/
@Test
public void testHeartMode() {