-
Notifications
You must be signed in to change notification settings - Fork 3
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 #21 from superdesk/fix-unpublish
fix missing `extra.profile_id` after unpublish
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from unittest.mock import patch | ||
|
||
from tga.signal_hooks import generate_doi | ||
|
||
|
||
@patch("tga.signal_hooks._generate_short_unique_id") | ||
def test_generate_doi_existing_doi(mock_generate_short_unique_id): | ||
item = {"extra": {"doi": "existing_doi"}} | ||
updates = {} | ||
generate_doi(None, item, updates) | ||
assert item["extra"]["doi"] == "existing_doi" | ||
assert "extra" not in updates | ||
|
||
item = {"extra": {}} | ||
updates = {} | ||
generate_doi(None, item, updates) | ||
assert item["extra"]["doi"] is not None | ||
assert item["extra"]["doi"] == updates["extra"]["doi"] | ||
|
||
|
||
@patch("tga.signal_hooks._generate_short_unique_id") | ||
def test_generate_doi_new_doi(mock_generate_short_unique_id): | ||
item = {"extra": {}} | ||
updates = {} | ||
generate_doi(None, item, updates) | ||
assert item["extra"]["doi"] is not None | ||
assert item["extra"]["doi"] == updates["extra"]["doi"] |
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