Closed zpeters closed 5 years ago
Hey @zpeters I got this error when trying to test it:
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in Access.get/3
(elixir) lib/access.ex:316: Access.get({:msg, "no breach was found for given input"}, :msg,nil)
(has_my_gsuite_been_pwned) lib/has_my_gsuite_been_pwned/wrappers/have_i_been_pwned.ex:22: HasMyGsuiteBeenPwned.HaveIBeenPwned.get_simplified_breach_report/2
(elixir) lib/enum.ex:771: anonymous fn/3 in Enum.each/2
(stdlib) lists.erl:1263: :lists.foldl/3
(elixir) lib/enum.ex:1941: Enum.each/2
I think there's a pattern match that's not able to match when breaches aren't found for an email?
I can take a look at this. My fault, i definitely did not test for no breaches
If got a pattern added to the case to catch a "no breach response". Right now it is just returning nil
What i see is that on the frontend (web) side, I think we are calling back to HasMyGsuiteBeenPwned.ReportGenerator
to run check_user
on all users in a Gsuite "domain". Following the code, we are rejecting any nils so i believe this will get us what we want. I added in a basic unit test for a check_user
that will and will not have a breach report. Closing this PR and will open a fresh PR for all this.
Updated calls to ex_pwned with the ability to retry.
Added credo and did some minor cleanup