Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(clientapi): Return v2 test data #1514

Merged
merged 12 commits into from
Nov 19, 2019
Merged

Conversation

benjamingeer
Copy link

@benjamingeer benjamingeer commented Nov 11, 2019

This PR adds test requests and responses for the /v2/values route to the generated client API code.

I refactored the values E2E tests to move the generation of JSON-LD into functions and constants into SharedTestDataADM, where they can be used both by E2E tests and by client code generation.

I also refactored the TypeScript backend a bit to make the endpoint template easier to read.

Resolves #1513.

@benjamingeer benjamingeer added API/V2 clientapi frontend: Salsah, DSP-APP, BEOL, MLS, etc. labels Nov 11, 2019
@benjamingeer benjamingeer added this to the 2019-11 milestone Nov 11, 2019
@benjamingeer benjamingeer self-assigned this Nov 11, 2019
@benjamingeer benjamingeer mentioned this pull request Nov 11, 2019
@tobiasschweizer
Copy link
Contributor

That's great, thank you. Will try to integrate the generated v2 values endpoint test data in dasch-swiss/dsp-js-lib#86 and then review this PR.

Copy link
Contributor

@tobiasschweizer tobiasschweizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot find test data for a create still image file value request.

@benjamingeer
Copy link
Author

I cannot find test data for a create still image file value request.

That’s because there is no such request. A file value can only be created when creating a resource.

@tobiasschweizer
Copy link
Contributor

Ok, I removed the unit test that would not have worked with Knora.

@tobiasschweizer
Copy link
Contributor

I will think of a way to prevent clients from performing a create request for file values in the values endpoint.

@tobiasschweizer
Copy link
Contributor

get-still-image-file-value-response.json contains

{"knora-api:error":"org.knora.webapi.NotFoundException: Value with UUID goZ7JFRNSeqF-dNxsqAS7Q not found (maybe you do not have permission to see it, or it is marked as deleted)","@context":{"knora-api":"http://api.knora.org/ontology/knora-api/v2#"}}

@benjamingeer
Copy link
Author

Well, it’s a valid response, isn’t it? 😀

@tobiasschweizer
Copy link
Contributor

tobiasschweizer commented Nov 19, 2019

Well, it’s a valid response, isn’t it? 😀

I like it!

I am reloading my test data and will regenerate the code to rule out a local problem.

RouteUtilV2.runRdfRouteWithFuture(
requestMessageF = requestMessageFuture,
requestContext = requestContext,
settings = settings,
responderManager = responderManager,
log = log,
targetSchema = targetSchema,
schemaOptions = schemaOptions
targetSchema = ApiV2Complex,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the simple schema be rejected?

settings = settings,
responderManager = responderManager,
log = log,
targetSchema = ApiV2Complex,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the simple schema be rejected?

@benjamingeer
Copy link
Author

Would the simple schema be rejected?

Yes. Added tests for this.

@benjamingeer benjamingeer merged commit 83a9044 into develop Nov 19, 2019
@benjamingeer benjamingeer deleted the wip/1513-values-test-data branch November 19, 2019 14:35
@tobiasschweizer tobiasschweizer mentioned this pull request Nov 20, 2019
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API/V2 clientapi frontend: Salsah, DSP-APP, BEOL, MLS, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate V2 Values Route Test Data
2 participants