use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class ExtensionForcedUserUnitTest method shouldImportContextWithNoForcedUser.
@Test
void shouldImportContextWithNoForcedUser() {
// Given
Context context = mock(Context.class);
Configuration config = new ZapXmlConfiguration();
// When
extensionForcedUser.importContextData(context, config);
// Then
verify(context, times(0)).getId();
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class ExtensionForcedUserUnitTest method shouldNotImportContextWithUnknownForcedUser.
@Test
void shouldNotImportContextWithUnknownForcedUser() {
// Given
given(extensionLoader.getExtension(ExtensionUserManagement.class)).willReturn(new ExtensionUserManagement());
Context context = mock(Context.class);
Configuration config = new ZapXmlConfiguration();
config.setProperty("context.forceduser", Integer.MIN_VALUE);
// When / Then
assertThrows(IllegalStateException.class, () -> extensionForcedUser.importContextData(context, config));
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class AddOnCollectionUnitTest method setUp.
@BeforeEach
void setUp() throws Exception {
configA = new ZapXmlConfiguration();
configA.setDelimiterParsingDisabled(true);
configA.load(new StringReader(CONF_A));
configB = new ZapXmlConfiguration();
configB.setDelimiterParsingDisabled(true);
configB.load(new StringReader(CONF_B));
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class AddOnCollectionUnitTest method shouldRejectAddOnsWithCircularDependencies.
@Test
void shouldRejectAddOnsWithCircularDependencies() throws Exception {
// Given
ZapXmlConfiguration zapVersions = createConfiguration("ZapVersions-cyclic-deps.xml");
// When
AddOnCollection addOnCollection = new AddOnCollection(zapVersions, Platform.daily, false);
// Then
assertThat(addOnCollection.getAddOns().size(), is(equalTo(4)));
assertThat(addOnCollection.getAddOn("AddOn2"), is(notNullValue()));
assertThat(addOnCollection.getAddOn("AddOn3"), is(notNullValue()));
assertThat(addOnCollection.getAddOn("AddOn8"), is(notNullValue()));
assertThat(addOnCollection.getAddOn("AddOn9"), is(notNullValue()));
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class AddOnCollectionUnitTest method shouldRejectAddOnsWithMissingDependencies.
@Test
void shouldRejectAddOnsWithMissingDependencies() throws Exception {
// Given
ZapXmlConfiguration zapVersions = createConfiguration("ZapVersions-missing-deps.xml");
// When
AddOnCollection addOnCollection = new AddOnCollection(zapVersions, Platform.daily, false);
// Then
assertThat(addOnCollection.getAddOns().size(), is(equalTo(3)));
assertThat(addOnCollection.getAddOn("AddOn3"), is(notNullValue()));
assertThat(addOnCollection.getAddOn("AddOn8"), is(notNullValue()));
assertThat(addOnCollection.getAddOn("AddOn9"), is(notNullValue()));
}
Aggregations