docs: Add new Testing guide

It's pretty bare-bones at the moment, but does close #476 by mentioning
that `bcrypt_elixir` can be tweaked for faster tests
This commit is contained in:
Rebecca Le 2023-12-06 10:45:20 +08:00
parent 15ea60dfd1
commit 739a544651
No known key found for this signature in database
GPG key ID: 45EC503B31710A41
3 changed files with 22 additions and 0 deletions

View file

@ -91,6 +91,10 @@ Dispatching to plugs directly:
...> conn = Strategy.plug(strategy, :reset_request, conn)
...> {_conn, :ok} = Plug.Helpers.get_authentication_result(conn)
## Testing
See the [Testing guide](/documentation/topics/testing.md) for tips on testing resources using this strategy.
## DSL Documentation
Strategy for authenticating using local resources as the source of truth.

View file

@ -0,0 +1,14 @@
# Testing
Tips and tricks to help test your apps.
## When using the Password strategy
AshAuthentication uses `bcrypt_elixir` for hashing passwords for secure storage, which by design has a high computational cost. To reduce the cost (make hashing faster), you can reduce the number of computation rounds it performs in tests:
```elixir
# in config/test.exs
# Do NOT set this value for production
config :bcrypt_elixir, log_rounds: 1
```

View file

@ -90,6 +90,10 @@ defmodule AshAuthentication.Strategy.Password do
...> conn = Strategy.plug(strategy, :reset_request, conn)
...> {_conn, :ok} = Plug.Helpers.get_authentication_result(conn)
## Testing
See the [Testing guide](/documentation/topics/testing.md) for tips on testing resources using this strategy.
## DSL Documentation
#{Spark.Dsl.Extension.doc_entity(Dsl.dsl())}