Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix public_id #1666

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/controllers/api/datapass_webhooks_v2_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def datapass_webhook_params
:model_type,
:model_id,
:fired_at,
:public_id,
data: {}
).to_h.symbolize_keys
end
Expand Down
2 changes: 1 addition & 1 deletion app/interactors/datapass_webhook/adapt_v2_to_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def build_data
{
'pass' => {
'id' => context.model_id,
'public_id' => context.public_id,
'public_id' => context.data['public_id'],
'intitule' => generic_data['intitule'],
'description' => generic_data['description'],
'demarche' => context.data['form_uid'],
Expand Down
14 changes: 2 additions & 12 deletions spec/controllers/api/datapass_webhooks_v2_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
'event' => event,
'model_id' => 9001,
'model_type' => 'Pass',
'public_id' => public_id,
'fired_at' => Time.now.to_i.to_s,
'data' => {
'what' => 'ever'
}
}
end

let(:public_id) { SecureRandom.uuid }

describe '#api_entreprise' do
subject do
post :api_entreprise, params:
Expand Down Expand Up @@ -59,15 +56,8 @@
)
end

it 'calls DatapassWebhook::V2::APIEntreprise with public id and data)' do
expect(DatapassWebhook::V2::APIEntreprise).to receive(:call).with(
hash_including(
public_id:,
data: {
'what' => 'ever'
}
)
)
it 'calls DatapassWebhook::V2::APIEntreprise' do
expect(DatapassWebhook::V2::APIEntreprise).to receive(:call)

subject
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/datapass_webhooks_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
initialize_with { attributes.stringify_keys }

event { %w[refuse_application refuse].sample }
public_id { generate(:datapass_webhook_v2_public_id) }
model_id { generate(:datapass_webhook_v2_id) }
model_type { 'authorization_request/api_entreprise' }
fired_at { Time.zone.now.to_i }
Expand All @@ -17,6 +16,7 @@
initialize_with { attributes.stringify_keys }

state { %w[approved refused].sample }
public_id { generate(:datapass_webhook_v2_public_id) }
form_uid { 'api-entreprise' }
applicant factory: :datapass_webhook_applicant_v2
organization factory: :datapass_webhook_organization_v2
Expand Down
Loading