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.
After experimenting with couple different approaches, I believe testing
shinyauthr
functionalities against the Shiny example app ininst/
would be the most practical way as it allows to test the user-facing interface (leaving room to change the underlying logic, e.g hashing, etc.).Tests have been structured as:
Login:
user_name
andpassword
fields with collapsed sidebar).user_auth
is set to TRUE andinfo
gets update with user infos.sidebarCollapsed
is set to FALSE and logout button displays.Logout:
user_auth
to FALSE andinfo
to NULLsidebarCollapsed
to TRUETests run well under a minute (~26secs.), hence it shouldn't be required to skip tests when submitting.
Would be really interesting to understand if I overlooked any better approach to do this.
Help needed
Exporting values is needed in order to inspect them during testing. This is done by adding a call to
exportTestValues()
inapp.R
.On the other hand, exporting
user_data()
reactive data frame breaks the call, trowing the following error (even when in testmode):This is blocking me from testing the right data is being show to user respecting their permission level. Hence tests have been commented out
test-shinyauthr.R
.I am probably missing something obvious here but the same call works like a charm on a mock Shiny app.