-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove mock
AppContext
and use a concrete version in tests instead
There are some inconveniences of using a mock `AppContext`: 1. Need to use `mockall_double` when importing `AppContext` whenever it's needed for tests. This isn't a huge deal but is a little annoying. 2. Need to update the `mock!` any time definitions in the `AppContext` impl change 3. Code completion doesn't seem to be working -- `context.config()` doesn't show up, nor do the fields on the config. However there is at least one benefit: 1. In order to create a concrete redis pool, the creation code needs to run in an async context. This means that any test that needs the `AppContext` needs to run with `#[tokio::test]`. This isn't a huge deal, but is slightly inconvenient. However, using a mock `AppContext` removes this requirement (aside from the few tests that still need a concrete redis pool). To get the above benefit of a mock `AppContext` without the listed cons, we can mock just the `AppContextInner` that we already created for the `AppContext`. Then, we can still create the `AppContext` in tests without needing to create a concrete redis pool, code completiong works, and we don't need to sprinkle `mockall_double` everywhere (for the `AppContext` at least). Also, make `mockall_double` a dev dependency Closes #154
- Loading branch information
1 parent
0fc12e9
commit 31b1828
Showing
38 changed files
with
188 additions
and
261 deletions.
There are no files selected for viewing
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 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 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 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 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 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 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 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 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 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 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 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
Oops, something went wrong.