Skip to content

Commit

Permalink
build: update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUnderScorer committed Feb 27, 2024
1 parent 69bfd84 commit 0b8f623
Show file tree
Hide file tree
Showing 20 changed files with 3,801 additions and 819 deletions.
19 changes: 9 additions & 10 deletions scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
curl -o ./res/fingerprint-server-api.yaml https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi/schemas/fingerprint-server-api-compact.yaml

examplesList=(
'visits_limit_500.json'
'get_visits_200_limit_500.json'
'visits_403_error.json'
'visits_too_many_requests_error.json'
'get_event_extra_fields.json'
'get_event.json'
'get_event_all_errors.json'
'get_visits_429_too_many_requests_error.json'
'get_event_200_extra_fields.json'
'get_event_200.json'
'get_event_200_all_errors.json'
'get_event_403_error.json'
'get_event_404_error.json'
'get_event_botd_failed_error.json'
'get_event_botd_too_many_requests_error.json'
'get_event_extra_fields.json'
'get_event_identification_failed_error.json'
'get_event_identification_too_many_requests_error.json'
'get_event_200_botd_failed_error.json'
'get_event_200_botd_too_many_requests_error.json'
'get_event_200_identification_failed_error.json'
'get_event_200_identification_too_many_requests_error.json'
)

for example in ${examplesList[*]}; do
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/com/fingerprint/api/FingerprintApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ private InputStream getFileAsIOStream(final String fileName) {
@BeforeAll
public void before() throws ApiException, IOException {
api = Mockito.mock(FingerprintApi.class);
when(api.getEvent(MOCK_REQUEST_ID)).thenReturn(fetchMockWithEventResponse("mocks/get_event.json"));
when(api.getEvent(MOCK_REQUEST_ID)).thenReturn(fetchMockWithEventResponse("mocks/get_event_200.json"));
// TODO: Find the way to test SDK correctly for this scenario
// when(api.getEvent(MOCK_REQUEST_WITH_EXTRA_FIELDS_ID)).thenReturn(fetchMockWithEventResponse("mocks/get_event_extra_fields.json"));
when(api.getEvent(MOCK_REQUEST_WITH_ALL_FAILED_SIGNALS)).thenReturn(fetchMockWithEventResponse("mocks/get_event_all_errors.json"));
when(api.getEvent(MOCK_REQUEST_BOTD_FAILED)).thenReturn(fetchMockWithEventResponse("mocks/get_event_botd_failed_error.json"));
when(api.getEvent(MOCK_REQUEST_BOTD_MANY_REQUEST)).thenReturn(fetchMockWithEventResponse("mocks/get_event_botd_too_many_requests_error.json"));
when(api.getEvent(MOCK_REQUEST_IDENTIFICATION_FAILED)).thenReturn(fetchMockWithEventResponse("mocks/get_event_identification_failed_error.json"));
when(api.getEvent(MOCK_REQUEST_IDENTIFICATION_MANY_REQUEST)).thenReturn(fetchMockWithEventResponse("mocks/get_event_identification_too_many_requests_error.json"));
// when(api.getEvent(MOCK_REQUEST_WITH_EXTRA_FIELDS_ID)).thenReturn(fetchMockWithEventResponse("mocks/get_event_200_extra_fields.json"));
when(api.getEvent(MOCK_REQUEST_WITH_ALL_FAILED_SIGNALS)).thenReturn(fetchMockWithEventResponse("mocks/get_event_200_all_errors.json"));
when(api.getEvent(MOCK_REQUEST_BOTD_FAILED)).thenReturn(fetchMockWithEventResponse("mocks/get_event_200_botd_failed_error.json"));
when(api.getEvent(MOCK_REQUEST_BOTD_MANY_REQUEST)).thenReturn(fetchMockWithEventResponse("mocks/get_event_200_botd_too_many_requests_error.json"));
when(api.getEvent(MOCK_REQUEST_IDENTIFICATION_FAILED)).thenReturn(fetchMockWithEventResponse("mocks/get_event_200_identification_failed_error.json"));
when(api.getEvent(MOCK_REQUEST_IDENTIFICATION_MANY_REQUEST)).thenReturn(fetchMockWithEventResponse("mocks/get_event_200_identification_too_many_requests_error.json"));

when(api.getVisits(MOCK_VISITOR_ID, MOCK_VISITOR_REQUEST_ID, null, 50, "1683900801733.Ogvu1j", null)).thenReturn(fetchMockVisit());
}
Expand All @@ -74,7 +74,7 @@ private EventResponse fetchMockWithEventResponse(String fileName) throws IOExcep
private Response fetchMockVisit() throws IOException {
ObjectMapper mapper = new ObjectMapper().registerModule(new JavaTimeModule());

return mapper.readValue(getFileAsIOStream("mocks/visits_limit_500.json"), Response.class);
return mapper.readValue(getFileAsIOStream("mocks/get_visits_200_limit_500.json"), Response.class);
}

/**
Expand Down
89 changes: 0 additions & 89 deletions src/test/resources/mocks/get_event.json

This file was deleted.

Loading

0 comments on commit 0b8f623

Please sign in to comment.