-
Notifications
You must be signed in to change notification settings - Fork 494
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
8251 refactor api tests #8254
Closed
Closed
8251 refactor api tests #8254
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will allow for a standardized collection of Strings thus avoid typos
This extension allows to set and reset database settings within a target Dataverse instance. It will make sure to reset to old setting or remove the setting if not set before the test. This was introduced for three reasons: 1. Don't execute a test if the setting did not go through 2. Don't forget to reset or remove to keep a consistent state after a test execution 3. Make the code more readable, as setting the setting has been part of the test before (which is bad design and might go booboo, see 2)
poikilotherm
added
Feature: API
Component: Code Infrastructure
formerly "Feature: Code Infrastructure"
Feature: Developer Guide
labels
Nov 22, 2021
…IQSS#8251 When no stored procedure has been set up in the instance under test, test running after DatasetsIT.testStoredProcGeneratedAsIdentifierGenerationStyle() failed, as the database setting was never reverted. Making use of the new @DBSetting extension helps with that.
poikilotherm
force-pushed
the
8251-refactor-api-tests
branch
from
November 22, 2021 15:34
1a264eb
to
e34d71e
Compare
I started some implementation work last week, backporting from my container branch. See #8253 This is a showcase for now. |
Many API tests require the use of a random user, which is no SuT (subject under test). To gather such a user and ensure its deletion from a target Dataverse instance after a test, this extension provides a convenient way. Simple use ExtendWith and provide a RandomUser parameter, you're done.
This helper class tries to abstract the store retrieval and handles all the tiny details on retrieving in-depth context for a store.
With this commit, the RandomUserExtension may be used on a test class, @BeforeEach/All, @AfterEach/All methods and test methods. It will take care of deletion in the appropriate ways to ensure a healthy target environment. Using it on @AfterEach/All will return the formerly created user via @BeforeEach/All and enabled aftermath reuse of the user.
…o that only the terms of use and access are considered (and not the guestbook which should only be considered at file download in isDownloadPopupRequired).
"application/octet-stream" is the default when the user doesn't supply a content type. So if it's this, send it through Tika. Yes, a user can supply "application/octet-stream" and this will also be sent through Tika.
This avoids an NPE when the empty embargo (from the dialog that isn't shown) is found to be invalid and then getMaxDate() returns null and the code tries to format it for display in the error message (which also wouldn't show).
verified that the names withheld bundle entry already exists.
Update to v5.9
Update to v5.9
Update to v5.9
Duplicate of #9796, closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Component: Code Infrastructure
formerly "Feature: Code Infrastructure"
Feature: API
Feature: Developer Guide
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This pull request is adding a few example refactorings for API tests (and might be extended to do this for more).
It also add the JUnit 5 extensions described in #8251
Which issue(s) this PR closes:
Closes #8251
Special notes for your reviewer:
This is a showcase for now. Enjoy.
Suggestions on how to test this:
"Simply" use the usual integration testing routines. Will be included in CI based API test.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Nope.
Is there a release notes update needed for this change?:
It might be good to write one once this matures.
Additional documentation:
None yet.