Search in sources :

Example 1 with AttributeQueryContainerDto

use of uk.gov.ida.hub.samlengine.domain.AttributeQueryContainerDto in project verify-hub by alphagov.

the class AttributeQueryGeneratorTest method handle_shouldReturnDtoWithSamlMatchingServiceRequest.

// This test should move to the request builder?
@Test
public void handle_shouldReturnDtoWithSamlMatchingServiceRequest() {
    HubAttributeQueryRequest hubAttributeQueryRequest = aHubAttributeQueryRequest();
    Element transformedRequest = mock(Element.class);
    when(transformer.apply(any(HubAttributeQueryRequest.class))).thenReturn(transformedRequest);
    AttributeQueryContainerDto attributeQueryDto = attributeQueryGenerator.createAttributeQueryContainer(hubAttributeQueryRequest, URI.create("/dont_care"), MATCHING_SERVICE_ENTITY_ID, null, false);
    assertThat(attributeQueryDto.getSamlRequest()).isEqualTo(XmlUtils.writeToString(transformedRequest));
}
Also used : AttributeQueryContainerDto(uk.gov.ida.hub.samlengine.domain.AttributeQueryContainerDto) Element(org.w3c.dom.Element) HubAttributeQueryRequest(uk.gov.ida.saml.hub.domain.HubAttributeQueryRequest) Test(org.junit.jupiter.api.Test)

Example 2 with AttributeQueryContainerDto

use of uk.gov.ida.hub.samlengine.domain.AttributeQueryContainerDto in project verify-hub by alphagov.

the class AttributeQueryGeneratorTest method handle_shouldReturnDtoWithMatchingServiceEndpointReturnedFromConfig.

@Test
public void handle_shouldReturnDtoWithMatchingServiceEndpointReturnedFromConfig() {
    HubAttributeQueryRequest hubAttributeQueryRequest = aHubAttributeQueryRequest();
    URI attributeQueryUri = URI.create("/attribute-query-uri");
    AttributeQueryContainerDto attributeQueryDto = attributeQueryGenerator.createAttributeQueryContainer(hubAttributeQueryRequest, attributeQueryUri, MATCHING_SERVICE_ENTITY_ID, null, false);
    assertThat(attributeQueryDto.getMatchingServiceUri()).isEqualTo(attributeQueryUri);
}
Also used : AttributeQueryContainerDto(uk.gov.ida.hub.samlengine.domain.AttributeQueryContainerDto) HubAttributeQueryRequest(uk.gov.ida.saml.hub.domain.HubAttributeQueryRequest) URI(java.net.URI) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 AttributeQueryContainerDto (uk.gov.ida.hub.samlengine.domain.AttributeQueryContainerDto)2 HubAttributeQueryRequest (uk.gov.ida.saml.hub.domain.HubAttributeQueryRequest)2 URI (java.net.URI)1 Element (org.w3c.dom.Element)1