Skip to content

Commit

Permalink
fix object POST in flag test
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Nov 26, 2024
1 parent cb4ac27 commit 820b017
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions spec/requests/reports_spec.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
RSpec.describe "Reports" do
let(:user) { create :user }
let(:report_body) {
<<-EOF
{
"@context":"https://www.w3.org/ns/activitystreams",
"id":"https://mastodon.me.uk/d977f377-214b-4efd-8a47-70a37fb7ea20",
"type":"Flag",
"actor":"https://mastodon.me.uk/actor",
"content":"Test, please ignore",
"object":[
"https://example.com/models/abc123"
]
}
EOF
}
let(:report_body) { {
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://mastodon.me.uk/d977f377-214b-4efd-8a47-70a37fb7ea20",
"type": "Flag",
"actor": "https://mastodon.me.uk/actor",
"content": "Test, please ignore",
"object": [
"https://example.com/models/abc123"
]
} }

it "should accept Flag activities" do
post user.actor.inbox_url, params: report_body, headers: { content_type: "application/activity" }
expect(response.status).to be :created
post user.actor.inbox_url, params: report_body, as: :json
expect(response.status).to eq 201
end

it "should call registered Report handler when a flag is received by Federails" do
expect(Federails::Moderation::Report).to receive(:handle_flag).once.and_call_original
post user.actor.inbox_url, params: report_body, headers: { content_type: "application/activity" }
post user.actor.inbox_url, params: report_body, as: :json
end
end

0 comments on commit 820b017

Please sign in to comment.