|
7 | 7 | import no.nav.registre.sdforvalter.consumer.rs.kodeverk.response.KodeverkResponse;
|
8 | 8 | import no.nav.registre.sdforvalter.database.model.AaregModel;
|
9 | 9 | import no.nav.registre.sdforvalter.database.repository.AaregRepository;
|
10 |
| -import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold; |
11 | 10 | import no.nav.testnav.libs.securitycore.domain.AccessToken;
|
12 | 11 | import no.nav.testnav.libs.securitycore.domain.ServerProperties;
|
13 | 12 | import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange;
|
14 | 13 | import no.nav.testnav.libs.testing.JsonWiremockHelper;
|
15 | 14 | import org.junit.jupiter.api.AfterEach;
|
16 | 15 | import org.junit.jupiter.api.BeforeAll;
|
17 |
| -import org.junit.jupiter.api.Disabled; |
18 | 16 | import org.junit.jupiter.api.Test;
|
19 | 17 | import org.junit.jupiter.api.extension.ExtendWith;
|
20 | 18 | import org.springframework.beans.factory.annotation.Autowired;
|
21 | 19 | import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
22 | 20 | import org.springframework.boot.test.context.SpringBootTest;
|
23 | 21 | import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
|
24 | 22 | import org.springframework.context.annotation.Import;
|
25 |
| -import org.springframework.http.HttpStatus; |
26 | 23 | import org.springframework.http.MediaType;
|
27 | 24 | import org.springframework.test.context.ActiveProfiles;
|
28 | 25 | import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
@@ -87,72 +84,6 @@ private AaregModel createAaregModel() {
|
87 | 84 | return model;
|
88 | 85 | }
|
89 | 86 |
|
90 |
| - @Disabled("Fix verify GET on (.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder") |
91 |
| - @Test |
92 |
| - void shouldInitiateAaregFromDatabase() throws Exception { |
93 |
| - final AaregModel aaregModel = createAaregModel(); |
94 |
| - aaregRepository.save(aaregModel); |
95 |
| - |
96 |
| - var arbeidsforholdmelding = objectMapper.readValue(syntString, syntResponse); |
97 |
| - |
98 |
| - when(tokenExchange.exchange(any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("dummy"))); |
99 |
| - |
100 |
| - JsonWiremockHelper |
101 |
| - .builder(objectMapper) |
102 |
| - .withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidstaker/arbeidsforhold") |
103 |
| - .withResponseBody(Collections.emptyList()) |
104 |
| - .stubGet(); |
105 |
| - |
106 |
| - JsonWiremockHelper |
107 |
| - .builder(objectMapper) |
108 |
| - .withUrlPathMatching("(.*)/synt-aareg/api/v1/generate_aareg") |
109 |
| - .withRequestBody(Collections.singletonList(FNR)) |
110 |
| - .withResponseBody(arbeidsforholdmelding) |
111 |
| - .stubPost(HttpStatus.OK); |
112 |
| - |
113 |
| - JsonWiremockHelper |
114 |
| - .builder(objectMapper) |
115 |
| - .withUrlPathMatching("(.*)/kodeverk/api/v1/kodeverk/Yrker/koder") |
116 |
| - .withResponseBody(kodeverkResponse) |
117 |
| - .stubGet(); |
118 |
| - |
119 |
| - JsonWiremockHelper |
120 |
| - .builder(objectMapper) |
121 |
| - .withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidsforhold") |
122 |
| - .withResponseBody(Arbeidsforhold.builder().build()) |
123 |
| - .stubPost(HttpStatus.OK); |
124 |
| - |
125 |
| - mvc.perform(post("/api/v1/orkestrering/aareg/" + MILJOE) |
126 |
| - .contentType(MediaType.APPLICATION_JSON).with(jwt())) |
127 |
| - .andExpect(status().isOk()); |
128 |
| - |
129 |
| - JsonWiremockHelper |
130 |
| - .builder(objectMapper) |
131 |
| - .withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidstaker/arbeidsforhold") |
132 |
| - .withResponseBody(Collections.emptyList()) |
133 |
| - .verifyGet(); |
134 |
| - |
135 |
| - JsonWiremockHelper |
136 |
| - .builder(objectMapper) |
137 |
| - .withUrlPathMatching("(.*)/synt-aareg/api/v1/generate_aareg") |
138 |
| - .withRequestBody(Collections.singletonList(FNR)) |
139 |
| - .withResponseBody(arbeidsforholdmelding) |
140 |
| - .verifyPost(); |
141 |
| - |
142 |
| - JsonWiremockHelper |
143 |
| - .builder(objectMapper) |
144 |
| - .withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder") |
145 |
| - .withResponseBody(kodeverkResponse) |
146 |
| - .verifyGet(); |
147 |
| - |
148 |
| - JsonWiremockHelper |
149 |
| - .builder(objectMapper) |
150 |
| - .withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidsforhold") |
151 |
| - .withResponseBody(Arbeidsforhold.builder().build()) |
152 |
| - .verifyPost(); |
153 |
| - |
154 |
| - } |
155 |
| - |
156 | 87 | @Test
|
157 | 88 | void shouldNotOppretteAaregWhenAlreadyExists() throws Exception {
|
158 | 89 | final AaregModel aaregModel = createAaregModel();
|
@@ -180,56 +111,4 @@ void shouldNotOppretteAaregWhenAlreadyExists() throws Exception {
|
180 | 111 | .verifyGet();
|
181 | 112 |
|
182 | 113 | }
|
183 |
| - |
184 |
| - @Disabled("Fix verify GET on (.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder") |
185 |
| - @Test |
186 |
| - void shouldNotOppretteAaregIfSyntError() throws Exception { |
187 |
| - final AaregModel aaregModel = createAaregModel(); |
188 |
| - aaregRepository.save(aaregModel); |
189 |
| - |
190 |
| - when(tokenExchange.exchange(any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("dummy"))); |
191 |
| - |
192 |
| - JsonWiremockHelper |
193 |
| - .builder(objectMapper) |
194 |
| - .withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidstaker/arbeidsforhold") |
195 |
| - .withResponseBody(Collections.emptyList()) |
196 |
| - .stubGet(); |
197 |
| - |
198 |
| - JsonWiremockHelper |
199 |
| - .builder(objectMapper) |
200 |
| - .withUrlPathMatching("(.*)/synt-aareg/api/v1/generate_aareg") |
201 |
| - .withRequestBody(Collections.singletonList(FNR)) |
202 |
| - .withResponseBody("error") |
203 |
| - .stubPost(HttpStatus.OK); |
204 |
| - |
205 |
| - JsonWiremockHelper |
206 |
| - .builder(objectMapper) |
207 |
| - .withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder") |
208 |
| - .withResponseBody(kodeverkResponse) |
209 |
| - .stubGet(); |
210 |
| - |
211 |
| - mvc.perform(post("/api/v1/orkestrering/aareg/" + MILJOE) |
212 |
| - .contentType(MediaType.APPLICATION_JSON).with(jwt())) |
213 |
| - .andExpect(status().isOk()); |
214 |
| - |
215 |
| - JsonWiremockHelper |
216 |
| - .builder(objectMapper) |
217 |
| - .withUrlPathMatching("(.*)/aareg/test/api/v1/arbeidstaker/arbeidsforhold") |
218 |
| - .withResponseBody(Collections.emptyList()) |
219 |
| - .verifyGet(); |
220 |
| - |
221 |
| - JsonWiremockHelper |
222 |
| - .builder(objectMapper) |
223 |
| - .withUrlPathMatching("(.*)/synt-aareg/api/v1/generate_aareg") |
224 |
| - .withRequestBody(Collections.singletonList(FNR)) |
225 |
| - .withResponseBody("error") |
226 |
| - .verifyPost(); |
227 |
| - |
228 |
| - JsonWiremockHelper |
229 |
| - .builder(objectMapper) |
230 |
| - .withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder") |
231 |
| - .withResponseBody(kodeverkResponse) |
232 |
| - .verifyGet(); |
233 |
| - } |
234 |
| - |
235 | 114 | }
|
0 commit comments