Remove allure (phase2) (#2483)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -12,9 +12,6 @@ package org.eclipse.hawkbit.security.controller;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
||||
import org.eclipse.hawkbit.security.SecurityContextSerializer;
|
||||
@@ -28,8 +25,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@Feature("Unit Tests - Security")
|
||||
@Story("Gateway token authentication")
|
||||
/**
|
||||
* Feature: Unit Tests - Security<br/>
|
||||
* Story: Gateway token authentication
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class GatewayTokenAuthenticatorTest {
|
||||
|
||||
@@ -61,9 +60,10 @@ class GatewayTokenAuthenticatorTest {
|
||||
new SystemSecurityContext(tenantAware));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests successful authentication with gateway token")
|
||||
void testWithGwToken() {
|
||||
/**
|
||||
* Tests successful authentication with gateway token
|
||||
*/
|
||||
@Test void testWithGwToken() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(GATEWAY_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class))
|
||||
@@ -77,9 +77,10 @@ class GatewayTokenAuthenticatorTest {
|
||||
.hasFieldOrPropertyWithValue("principal", CONTROLLER_ID);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if gateway token doesn't match, the authentication fails")
|
||||
void testWithBadGwToken() {
|
||||
/**
|
||||
* Tests that if gateway token doesn't match, the authentication fails
|
||||
*/
|
||||
@Test void testWithBadGwToken() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class))
|
||||
@@ -91,15 +92,17 @@ class GatewayTokenAuthenticatorTest {
|
||||
assertThat(authenticator.authenticate(securityToken)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if gateway token miss, the authentication fails")
|
||||
void testWithoutGwToken() {
|
||||
/**
|
||||
* Tests that if gateway token miss, the authentication fails
|
||||
*/
|
||||
@Test void testWithoutGwToken() {
|
||||
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CONTROLLER_ID))).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if disabled, the authentication fails")
|
||||
void testWithGwTokenButDisabled() {
|
||||
/**
|
||||
* Tests that if disabled, the authentication fails
|
||||
*/
|
||||
@Test void testWithGwTokenButDisabled() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(GATEWAY_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_ENABLED, Boolean.class))
|
||||
|
||||
@@ -12,9 +12,6 @@ package org.eclipse.hawkbit.security.controller;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
||||
import org.eclipse.hawkbit.security.SecurityContextSerializer;
|
||||
@@ -28,8 +25,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@Feature("Unit Tests - Security")
|
||||
@Story("Security header authenticator")
|
||||
/**
|
||||
* Feature: Unit Tests - Security<br/>
|
||||
* Story: Security header authenticator
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class SecurityHeaderAuthenticatorTest {
|
||||
|
||||
@@ -72,9 +71,10 @@ class SecurityHeaderAuthenticatorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests successful authentication with multiple a single hashes")
|
||||
void testWithSingleKnownHash() {
|
||||
/**
|
||||
* Tests successful authentication with multiple a single hashes
|
||||
*/
|
||||
@Test void testWithSingleKnownHash() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(SINGLE_HASH);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
|
||||
@@ -88,9 +88,10 @@ class SecurityHeaderAuthenticatorTest {
|
||||
.hasFieldOrPropertyWithValue("principal", CA_COMMON_NAME_VALUE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests successful authentication with multiple hashes")
|
||||
void testWithMultipleKnownHashes() {
|
||||
/**
|
||||
* Tests successful authentication with multiple hashes
|
||||
*/
|
||||
@Test void testWithMultipleKnownHashes() {
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
|
||||
.thenReturn(CONFIG_VALUE_MULTI_HASH);
|
||||
@@ -109,9 +110,10 @@ class SecurityHeaderAuthenticatorTest {
|
||||
.hasFieldOrPropertyWithValue("principal", CA_COMMON_NAME_VALUE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if the hash is unknown, the authentication fails")
|
||||
void testWithUnknownHash() {
|
||||
/**
|
||||
* Tests that if the hash is unknown, the authentication fails
|
||||
*/
|
||||
@Test void testWithUnknownHash() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_HASH);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
|
||||
@@ -123,9 +125,10 @@ class SecurityHeaderAuthenticatorTest {
|
||||
assertThat(authenticator.authenticate(securityToken)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if CN doesn't match the CN in the security token, the authentication fails")
|
||||
void testWithNonMatchingCN() {
|
||||
/**
|
||||
* Tests that if CN doesn't match the CN in the security token, the authentication fails
|
||||
*/
|
||||
@Test void testWithNonMatchingCN() {
|
||||
final ControllerSecurityToken securityToken = new ControllerSecurityToken("DEFAULT", "otherControllerID");
|
||||
securityToken.putHeader(CA_COMMON_NAME, CA_COMMON_NAME_VALUE);
|
||||
securityToken.putHeader(X_SSL_ISSUER_HASH_1, SINGLE_HASH);
|
||||
@@ -133,15 +136,17 @@ class SecurityHeaderAuthenticatorTest {
|
||||
assertThat(authenticator.authenticate(securityToken)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if the hash miss, the authentication fails")
|
||||
void testWithoutHash() {
|
||||
/**
|
||||
* Tests that if the hash miss, the authentication fails
|
||||
*/
|
||||
@Test void testWithoutHash() {
|
||||
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CA_COMMON_NAME_VALUE))).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if disabled, the authentication fails")
|
||||
void testWithSingleKnownHashButDisabled() {
|
||||
/**
|
||||
* Tests that if disabled, the authentication fails
|
||||
*/
|
||||
@Test void testWithSingleKnownHashButDisabled() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(SINGLE_HASH);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_ENABLED, Boolean.class))
|
||||
|
||||
@@ -14,9 +14,6 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
@@ -33,8 +30,10 @@ import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@Feature("Unit Tests - Security")
|
||||
@Story("Gateway token authentication")
|
||||
/**
|
||||
* Feature: Unit Tests - Security<br/>
|
||||
* Story: Gateway token authentication
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class SecurityTokenAuthenticatorTest {
|
||||
|
||||
@@ -66,9 +65,10 @@ class SecurityTokenAuthenticatorTest {
|
||||
new SystemSecurityContext(tenantAware), controllerManagementMock);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests successful authentication with gateway token")
|
||||
void testWithSecToken() {
|
||||
/**
|
||||
* Tests successful authentication with gateway token
|
||||
*/
|
||||
@Test void testWithSecToken() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(SECURITY_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
|
||||
@@ -84,9 +84,10 @@ class SecurityTokenAuthenticatorTest {
|
||||
.hasFieldOrPropertyWithValue("principal", CONTROLLER_ID);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if gateway token doesn't match, the authentication fails")
|
||||
void testWithBadSecToken() {
|
||||
/**
|
||||
* Tests that if gateway token doesn't match, the authentication fails
|
||||
*/
|
||||
@Test void testWithBadSecToken() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
|
||||
@@ -95,15 +96,17 @@ class SecurityTokenAuthenticatorTest {
|
||||
assertThat(authenticator.authenticate(securityToken)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if gateway token miss, the authentication fails")
|
||||
void testWithoutSecToken() {
|
||||
/**
|
||||
* Tests that if gateway token miss, the authentication fails
|
||||
*/
|
||||
@Test void testWithoutSecToken() {
|
||||
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CONTROLLER_ID))).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests that if disabled, the authentication fails")
|
||||
void testWithSecTokenButDisabled() {
|
||||
/**
|
||||
* Tests that if disabled, the authentication fails
|
||||
*/
|
||||
@Test void testWithSecTokenButDisabled() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(SECURITY_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
|
||||
|
||||
Reference in New Issue
Block a user