Skip to content

Commit

Permalink
Fjernet disabled tester
Browse files Browse the repository at this point in the history
#deploy-test-bruker-service
#deploy-test-pdl-forvalter
#deploy-test-frontend
  • Loading branch information
stigus committed Jan 14, 2025
1 parent 8f5b4f8 commit 1e8cac1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 237 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

import no.nav.testnav.libs.data.pdlforvalter.v1.BestillingRequestDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.FoedselDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.ForelderBarnRelasjonDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.PersonDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.PersonRequestDTO;
import no.nav.testnav.libs.data.pdlforvalter.v1.SivilstandDTO;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand All @@ -23,7 +19,6 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.doReturn;

@ExtendWith(MockitoExtension.class)
class RelasjonerAlderServiceTest {
Expand All @@ -42,68 +37,6 @@ void setup() {
fixedClock = Clock.fixed(LOCAL_DATE.atStartOfDay(ZoneId.systemDefault()).toInstant(), ZoneId.systemDefault());
}

@Test
@Disabled("Denne feiler av og til og trenger oppdatering")
void personAlderBarn23Forelder41() {

doReturn(fixedClock.instant()).when(clock).instant();
doReturn(fixedClock.getZone()).when(clock).getZone();

var bestilling = BestillingRequestDTO.builder()
.person(PersonDTO.builder()
.forelderBarnRelasjon(List.of(
ForelderBarnRelasjonDTO.builder()
.minRolleForPerson(ForelderBarnRelasjonDTO.Rolle.FORELDER)
.nyRelatertPerson(PersonRequestDTO.builder()
.foedtFoer(LocalDateTime.of(LocalDate.now(clock).getYear() - 23,
LocalDate.now(clock).getMonthValue(), LocalDate.now(clock).getDayOfMonth(), 1, 1))
.build())
.build()
))
.sivilstand(List.of(
SivilstandDTO.builder()
.type(SivilstandDTO.Sivilstand.GIFT)
.build()
))
.build())
.build();
var oppdatertBestilling = relasjonerAlderService.fixRelasjonerAlder(bestilling);
assertThat(oppdatertBestilling.getFoedtFoer().toLocalDate(),
is(equalTo(LocalDate.now(clock).minusYears(18 + 23))));
assertThat(oppdatertBestilling.getPerson().getSivilstand().getFirst().getNyRelatertPerson().getFoedtFoer().toLocalDate(),
is(equalTo(LocalDate.now(clock).minusYears(18 + 23))));
}

@Test
@Disabled("Denne feiler av og til og trenger oppdatering")
void personAlderBarn23Besteforeldre() {

doReturn(fixedClock.instant()).when(clock).instant();
doReturn(fixedClock.getZone()).when(clock).getZone();

var bestilling = BestillingRequestDTO.builder()
.person(PersonDTO.builder()
.forelderBarnRelasjon(List.of(
ForelderBarnRelasjonDTO.builder()
.minRolleForPerson(ForelderBarnRelasjonDTO.Rolle.FORELDER)
.nyRelatertPerson(PersonRequestDTO.builder()
.foedtFoer(LocalDateTime.of(LocalDate.now(clock).getYear() - 23,
LocalDate.now(clock).getMonthValue(), LocalDate.now(clock).getDayOfMonth(), 1, 1))
.build())
.build(),
ForelderBarnRelasjonDTO.builder()
.minRolleForPerson(ForelderBarnRelasjonDTO.Rolle.BARN)
.build()
))
.build())
.build();
var oppdatertBestilling = relasjonerAlderService.fixRelasjonerAlder(bestilling);
assertThat(oppdatertBestilling.getFoedtFoer().toLocalDate(),
is(equalTo(LocalDate.now(clock).minusYears(18 + 23))));
assertThat(oppdatertBestilling.getPerson().getForelderBarnRelasjon().get(1).getNyRelatertPerson().getFoedtFoer().toLocalDate(),
is(equalTo(LocalDate.now(clock).minusYears(18 + 23 + 36))));
}

@Test
void personMedFoedselsdag() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@
import no.nav.registre.sdforvalter.consumer.rs.kodeverk.response.KodeverkResponse;
import no.nav.registre.sdforvalter.database.model.AaregModel;
import no.nav.registre.sdforvalter.database.repository.AaregRepository;
import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold;
import no.nav.testnav.libs.securitycore.domain.AccessToken;
import no.nav.testnav.libs.securitycore.domain.ServerProperties;
import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange;
import no.nav.testnav.libs.testing.JsonWiremockHelper;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.context.annotation.Import;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
Expand Down Expand Up @@ -87,72 +84,6 @@ private AaregModel createAaregModel() {
return model;
}

@Disabled("Fix verify GET on (.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
@Test
void shouldInitiateAaregFromDatabase() throws Exception {
final AaregModel aaregModel = createAaregModel();
aaregRepository.save(aaregModel);

var arbeidsforholdmelding = objectMapper.readValue(syntString, syntResponse);

when(tokenExchange.exchange(any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("dummy")));

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidstaker/arbeidsforhold")
.withResponseBody(Collections.emptyList())
.stubGet();

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/synt-aareg/api/v1/generate_aareg")
.withRequestBody(Collections.singletonList(FNR))
.withResponseBody(arbeidsforholdmelding)
.stubPost(HttpStatus.OK);

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/kodeverk/api/v1/kodeverk/Yrker/koder")
.withResponseBody(kodeverkResponse)
.stubGet();

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidsforhold")
.withResponseBody(Arbeidsforhold.builder().build())
.stubPost(HttpStatus.OK);

mvc.perform(post("/api/v1/orkestrering/aareg/" + MILJOE)
.contentType(MediaType.APPLICATION_JSON).with(jwt()))
.andExpect(status().isOk());

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidstaker/arbeidsforhold")
.withResponseBody(Collections.emptyList())
.verifyGet();

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/synt-aareg/api/v1/generate_aareg")
.withRequestBody(Collections.singletonList(FNR))
.withResponseBody(arbeidsforholdmelding)
.verifyPost();

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
.withResponseBody(kodeverkResponse)
.verifyGet();

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidsforhold")
.withResponseBody(Arbeidsforhold.builder().build())
.verifyPost();

}

@Test
void shouldNotOppretteAaregWhenAlreadyExists() throws Exception {
final AaregModel aaregModel = createAaregModel();
Expand Down Expand Up @@ -180,56 +111,4 @@ void shouldNotOppretteAaregWhenAlreadyExists() throws Exception {
.verifyGet();

}

@Disabled("Fix verify GET on (.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
@Test
void shouldNotOppretteAaregIfSyntError() throws Exception {
final AaregModel aaregModel = createAaregModel();
aaregRepository.save(aaregModel);

when(tokenExchange.exchange(any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("dummy")));

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidstaker/arbeidsforhold")
.withResponseBody(Collections.emptyList())
.stubGet();

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/synt-aareg/api/v1/generate_aareg")
.withRequestBody(Collections.singletonList(FNR))
.withResponseBody("error")
.stubPost(HttpStatus.OK);

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
.withResponseBody(kodeverkResponse)
.stubGet();

mvc.perform(post("/api/v1/orkestrering/aareg/" + MILJOE)
.contentType(MediaType.APPLICATION_JSON).with(jwt()))
.andExpect(status().isOk());

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidstaker/arbeidsforhold")
.withResponseBody(Collections.emptyList())
.verifyGet();

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/synt-aareg/api/v1/generate_aareg")
.withRequestBody(Collections.singletonList(FNR))
.withResponseBody("error")
.verifyPost();

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
.withResponseBody(kodeverkResponse)
.verifyGet();
}

}

This file was deleted.

This file was deleted.

0 comments on commit 1e8cac1

Please sign in to comment.