+ test "a list of activities" do
+ user = insert(:user)
+ other_user = insert(:user, %{nickname: "shp"})
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!"})
+
+ convo_id = TwitterAPI.context_to_conversation_id(activity.data["object"]["context"])
+
+ mocks = [
+ {
+ TwitterAPI,
+ [],
+ [context_to_conversation_id: fn _ -> false end]
+ },
+ {
+ User,
+ [:passthrough],
+ [get_cached_by_ap_id: fn _ -> nil end]
+ }
+ ]
+
+ with_mocks mocks do
+ [result] = ActivityView.render("index.json", activities: [activity])
+
+ assert result["statusnet_conversation_id"] == convo_id
+ assert result["user"]
+ refute called(TwitterAPI.context_to_conversation_id(:_))
+ refute called(User.get_cached_by_ap_id(user.ap_id))
+ refute called(User.get_cached_by_ap_id(other_user.ap_id))
+ end
+ end
+