-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #511 from slovensko-digital/GO-151/fix_datetimes
GO-151 Fix datetimes fetched from FS API
- Loading branch information
Showing
2 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
require "active_support/all" | ||
|
||
class Fs::MessageTest < ActiveSupport::TestCase | ||
test "#create_inbox_messages creates new message with delivered_at and fs_submission_created_at values in same format" do | ||
raw_message = { | ||
"created_at" => "2024-06-05T10:27:03.105Z", | ||
"message_id" => "12345689/2024", | ||
"submission_type_id" => "3079", | ||
"submission_type_name" => "Podanie pre FS (Správa daní) – späťvzatie žiadosti", | ||
"message_type_id" => "DRSR_POPP_v02", | ||
"message_type_name" => "Informácia o podaní", | ||
"sent_message_id" => "12345689/2024", | ||
"seen" => true, | ||
"is_ekr2" => true, | ||
"status" => "Vybavená", | ||
"submission_status" => "Prijaté a potvrdené", | ||
"dic" => "1122222333", | ||
"subject" => "xy", | ||
"submitting_subject" => "xy", | ||
"submission_created_at" => "2024-06-05T10:27:01.433Z", | ||
"period" => nil, | ||
"dismissal_reason" => nil, | ||
"message_container" => | ||
{ | ||
"message_id" => SecureRandom.uuid, | ||
"sender_id" => "FSSR", | ||
"recipient_id" => "1122222333", | ||
"message_type" => "ED.DeliveryReport", | ||
"subject" => "x", | ||
"objects" => [ | ||
{ | ||
"class" => "FORM", | ||
"description" => "DeliveryReport", | ||
"encoding" => "Base64", | ||
"id" => SecureRandom.uuid, | ||
"signed" => true, | ||
"mime_type" => "application/vnd.etsi.asic-e+zip", | ||
"name" => "DeliveryReport", | ||
"content" => | ||
"content xy" | ||
} | ||
] | ||
} | ||
} | ||
|
||
message = Fs::Message.create_inbox_message(raw_message) | ||
|
||
assert_equal '2024-06-05 12:27:03 +0200', message.delivered_at.to_s | ||
assert_equal '2024-06-05T12:27:01.433+02:00', message.metadata['fs_submission_created_at'] | ||
end | ||
end |