Closed andodet closed 3 years ago
Thanks so much for this! Sorry I'm super busy at the moment so haven't had time to test yet but will do asap.
Thanks again, Paul
Another thing I forgot to mention is that by testing the example Shiny application, devtools::test_coverage()
will obviously result in a 0% as we're not testing the core package functions. If it's a deal breaker, other approaches must be explored.
Hi. Just added some tests in #52 . Mostly inspired by this PR - thanks for the contribution. And sorry it took so long!
Hey @PaulC91, no worries - happy it helped in any way. Hope to see the package on CRAN at some point.
@andodet made it to CRAN! https://cran.r-project.org/package=shinyauthr
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.