-
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.
- Loading branch information
1 parent
c2e3020
commit 90b0bb8
Showing
4 changed files
with
99 additions
and
4 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 |
---|---|---|
@@ -1,7 +1,81 @@ | ||
require "test_helper" | ||
|
||
class Govbox::SyncBoxJobTest < ActiveJob::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
test "schedules Govbox::SyncFolderJob with low priority if initial box sync" do | ||
box = boxes(:ssd_main) | ||
|
||
edesk_api_mock = Minitest::Mock.new | ||
edesk_api_mock.expect :fetch_folders, [200, [ | ||
{ | ||
"id" => "123456", | ||
"name" => "Inbox", | ||
"system" => true | ||
}, | ||
{ | ||
"id" => "7890123", | ||
"name" => "MyName", | ||
"system" => false | ||
}, | ||
{ | ||
"id" => "135790", | ||
"name" => "Bin", | ||
"system" => true | ||
}, | ||
{ | ||
"id" => "24580", | ||
"name" => "Drafts", | ||
"system" => true | ||
}, | ||
{ | ||
"id" => "24589", | ||
"name" => "SentItems", | ||
"system" => true | ||
}, | ||
]] | ||
|
||
::Upvs::GovboxApi::Edesk.stub :new, edesk_api_mock do | ||
assert_enqueued_with(job: Govbox::SyncFolderJob, priority: 100) do | ||
Govbox::SyncBoxJob.new.perform(box, initial_import: true) | ||
end | ||
end | ||
end | ||
|
||
test "schedules Govbox::SyncFolderJob with no priority unless initial box sync" do | ||
box = boxes(:ssd_main) | ||
|
||
edesk_api_mock = Minitest::Mock.new | ||
edesk_api_mock.expect :fetch_folders, [200, [ | ||
{ | ||
"id" => "123456", | ||
"name" => "Inbox", | ||
"system" => true | ||
}, | ||
{ | ||
"id" => "7890123", | ||
"name" => "MyName", | ||
"system" => false | ||
}, | ||
{ | ||
"id" => "135790", | ||
"name" => "Bin", | ||
"system" => true | ||
}, | ||
{ | ||
"id" => "24580", | ||
"name" => "Drafts", | ||
"system" => true | ||
}, | ||
{ | ||
"id" => "24589", | ||
"name" => "SentItems", | ||
"system" => true | ||
}, | ||
]] | ||
|
||
::Upvs::GovboxApi::Edesk.stub :new, edesk_api_mock do | ||
assert_enqueued_with(job: Govbox::SyncFolderJob, priority: nil) do | ||
Govbox::SyncBoxJob.new.perform(box) | ||
end | ||
end | ||
end | ||
end |
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
13 changes: 13 additions & 0 deletions
13
test/models/govbox/authorize_delivery_notification_action_test.rb
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,13 @@ | ||
require "test_helper" | ||
|
||
class Govbox::AuthorizeDeliveryNotificationActionTest < ActiveSupport::TestCase | ||
include ActiveJob::TestHelper | ||
|
||
test "schedules Govbox::AuthorizeDeliveryNotificationJob with highest priority" do | ||
message = messages(:solver_main_delivery_notification_two) | ||
|
||
assert_enqueued_with(job: Govbox::AuthorizeDeliveryNotificationJob, priority: -1000) do | ||
Govbox::AuthorizeDeliveryNotificationAction.run(message) | ||
end | ||
end | ||
end |