Commit cdc5ecce authored by Mayel's avatar Mayel

test for consent

parent 3d6974da
Pipeline #219032778 failed with stage
in 55 seconds
......@@ -23,7 +23,7 @@ defmodule CommonsPub.Collections do
alias CommonsPub.Users.User
alias CommonsPub.Workers.APPublishWorker
alias CommonsPub.Utils.Web.CommonHelper
# alias CommonsPub.Utils.Web.CommonHelper
def cursor(:followers), do: &[&1.follower_count, &1.id]
......
......@@ -39,7 +39,7 @@ defmodule ValueFlows.Knowledge.ResourceSpecification do
field(:deleted_at, :utc_datetime_usec)
has_many(:conforming_resources, ValueFlows.Observation.EconomicResource, foreign_key: :conforms_to)
has_many(:conforming_resources, ValueFlows.Observation.EconomicResource, foreign_key: :conforms_to_id)
many_to_many(:tags, CommonsPub.Tag.Taggable,
join_through: "tags_things",
......
......@@ -37,7 +37,7 @@ defmodule ValueFlows.Proposal.ProposedToGraphQL do
def fetch_proposed_edge(%{proposed_id: id} = thing, _, _)
when is_binary(id) do
thing = Repo.preload(thing, :proposed)
thing = CommonsPub.Repo.preload(thing, :proposed)
{:ok, Map.get(thing, :proposed)}
end
......
......@@ -409,6 +409,28 @@ defmodule ValueFlows.Observation.EconomicEvent.EconomicEventsResourcesTest do
unit
)
end
test "if transfering a resource without consent, stop" do
user1 = fake_user!()
user2 = fake_user!()
unit = fake_unit!(user1)
resource_inventoried_as = fake_economic_resource!(user1, %{}, unit)
to_resource_inventoried_as = fake_economic_resource!(user2, %{}, unit)
assert {:error, e} =
fake_economic_event!(
user2,
%{
to_resource_inventoried_as: to_resource_inventoried_as.id,
resource_inventoried_as: resource_inventoried_as.id,
action: "transfer-custody"
},
unit
)
end
end
describe "DecrementIncrement with transfer-all-rights" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment