-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Johnny Mariéthoz <[email protected]>
- Loading branch information
Showing
3 changed files
with
90 additions
and
11 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
39 changes: 39 additions & 0 deletions
39
tests/unit/documents/serializers/test_document_json_schema.py
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,39 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Swiss Open Access Repository | ||
# Copyright (C) 2021 RERO | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, version 3 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""Test schema.org marshmallow schema.""" | ||
|
||
|
||
from sonar.modules.documents.marshmallow import DocumentMetadataSchemaV1 | ||
|
||
|
||
def test_partOf(document): | ||
"""Test partOf serialization.""" | ||
document = { | ||
'pid': '1', | ||
'organisation': [{ | ||
'$ref': 'https://sonar.rero.ch/api/organisations/org' | ||
}], | ||
'partOf': [{ | ||
'document': { | ||
'title': 'Host document', | ||
'contribution': ['Muller'] | ||
} | ||
}] | ||
} | ||
assert DocumentMetadataSchemaV1().dump( | ||
document)['partOf'][0]['document']['contribution'] == ['Muller'] |