setop

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

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

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?

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31194 112
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

We're in Beta

About us Mission Statement