setop
No expectation defined for Mobilizon
Hi,
I am maintaining the code base of Mobilizon : an event management platform for the Fediverse ; initially derived from Pleroma.
I’m having trouble with adapting the tests to a very small change.
What I get is :
- test/graphql/resolvers/member_test.exs:226
** (Mox.UnexpectedCallError) no expectation defined for Mobilizon.Service.HTTP.ActivityPub.Mock.call/2
- test/federation/activity_pub/transmogrifier/follow_test.exs:45
** (Mox.UnexpectedCallError) expected Mobilizon.Service.HTTP.ActivityPub.Mock.call/2 to be called once but it has been called 2 time
- test/federation/activity_pub/transmogrifier/undo_test.exs:51
** (Mox.UnexpectedCallError) expected Mobilizon.Service.HTTP.ActivityPub.Mock.call/2 to be called once but it has been called 2 times
- test/federation/activity_pub/transmogrifier/update_test.exs:160
** (Mox.UnexpectedCallError) no expectation defined for Mobilizon.Service.HTTP.ActivityPub.Mock.call/2
But I don’t know what an expectation is in the context of ExUnit and why it is sometimes called twice.
If someone can help me to feel less dumb, it would be really appreciated.
Most Liked
fuelen
expectation is not about ExUnit, but about Mox library. If you want to understand this then read this article first Mocks and explicit contracts - Dashbit Blog
and then Mox — Mox v1.2.0 to know how to declare new expectations.
al2o3cr
Mobilizon.Service.HTTP.ActivityPub is wired up to a mock in config/test.exs:
config :tesla, Mobilizon.Service.HTTP.ActivityPub,
adapter: Mobilizon.Service.HTTP.ActivityPub.Mock
You’ll need a similar stanza to ones like this to handle the :post request that publish_one makes.
One thing I do wonder: how was this working before? I haven’t chased down what inbox typically is in publish_one calls, but were the specs making a real HTTP request?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









