-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test coverage for the URL migration tasks
- Loading branch information
Jon Betts
committed
Jun 15, 2023
1 parent
f722293
commit 49c3960
Showing
2 changed files
with
36 additions
and
0 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,29 @@ | ||
from unittest.mock import sentinel | ||
|
||
import pytest | ||
|
||
from h.tasks.url_migration import move_annotations, move_annotations_by_url | ||
|
||
|
||
class TestURLMigrationTasks: | ||
def test_move_annotations_by_url(self, url_migration_service): | ||
move_annotations_by_url(sentinel.old_url, sentinel.new_url_info) | ||
|
||
url_migration_service.move_annotations_by_url.assert_called_once_with( | ||
sentinel.old_url, sentinel.new_url_info | ||
) | ||
|
||
def test_move_annotations(self, url_migration_service): | ||
move_annotations( | ||
sentinel.annotation_ids, sentinel.current_uri_normalized, sentinel.url_info | ||
) | ||
|
||
url_migration_service.move_annotations.assert_called_once_with( | ||
sentinel.annotation_ids, sentinel.current_uri_normalized, sentinel.url_info | ||
) | ||
|
||
@pytest.fixture(autouse=True) | ||
def celery(self, patch, pyramid_request): | ||
celery = patch("h.tasks.url_migration.celery") | ||
celery.request = pyramid_request | ||
return celery |