2021-10-04 18:59:41 +02:00
|
|
|
defmodule Mobilizon.Service.Export.Participants.CSVTest do
|
|
|
|
use Mobilizon.DataCase
|
|
|
|
|
|
|
|
import Mobilizon.Factory
|
|
|
|
|
|
|
|
alias Mobilizon.Events.Event
|
|
|
|
alias Mobilizon.Service.Export.Participants.CSV
|
|
|
|
|
|
|
|
describe "export event participants to csv" do
|
|
|
|
test "export basic infos" do
|
|
|
|
%Event{} = event = insert(:event)
|
|
|
|
insert(:participant, event: event, role: :creator)
|
|
|
|
insert(:participant, event: event, role: :participant)
|
|
|
|
insert(:participant, event: event, role: :not_approved)
|
|
|
|
|
|
|
|
assert CSV.ready?()
|
|
|
|
assert {:ok, path} = CSV.export(event)
|
2023-08-17 16:30:17 +02:00
|
|
|
assert content = File.read!("test/uploads/exports/csv/" <> path)
|
2021-10-04 18:59:41 +02:00
|
|
|
assert content =~ "Participant name,Participant status,Participant message"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|