Skip to content

Commit

Permalink
2.0: exemplary work
Browse files Browse the repository at this point in the history
* Beware the change in test_search_member_generator
* It might be caused by unspecified behaviour of API

Signed-off-by: Mateusz Susik <mateuszsusik@gmail.com>
  • Loading branch information
MSusik committed May 31, 2017
1 parent a3bb623 commit 477be7e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 70 deletions.
86 changes: 19 additions & 67 deletions orcid/testsuite/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,24 @@
WORK_NAME2 = u'WY51MF0OCMU37MVGMUX1M92G6FR1IQUW0'

exemplary_work = {
'title': {'title': WORK_NAME2,
'subtitle': 'My Subtitle',
'translated-title': {
'language-code': 'pl',
'value': u'API Tytuł testowy'}
},
'journal-title': 'Journal Title',
'short-description': 'My abstract',
'citation': {
'citation': '''@article {ORCIDtest2014,
author = "Lastname, Firstname",
title = "API Test Title",
journal = "Journal Title",
volume = "25",
number = "4",
year = "2010",
pages = "259-264",
doi = "doi:10.1087/20120404"
}''',
# Available types:
# 'FORMATTED-UNSPECIFIED'
# 'BIBTEX'
# 'FORMATTED_APA'
# 'FORMATTED_HARVARD'
# 'FORMATTED_IEEE'
# 'FORMATTED_MLA'
# 'FORMATTED_VANCOUVER'
# 'FORMATTED_CHICAGO'
'citation-type': 'BIBTEX'
"title": {
"title": {
"value": WORK_NAME2
},
# See http://members.orcid.org/api/supported-work-types
'type': 'JOURNAL_ARTICLE',
'publication-date': {'year': 2010,
'month': 11,
'day': 10
},
# See http://members.orcid.org/api/supported-work-identifiers
'external-ids': {'external-id': [{
'external-id-type': 'source-work-id',
'external-id-value': '1234',
'external-id-url': 'www.example.com/12344'
}]},
'url': 'https://github.com/MSusik/python-orcid',
'contributors': {'contributor': [{
'credit-name': 'LastName, FirstName',
'contributor-orcid': '0000-0001-5109-3700',
'contributor-email': 'somebody@mailinator.com',
'contributor-attributes': {
# Supported roles:
# 'AUTHOR'
# 'ASSIGNEE'
# 'EDITOR'
# 'CHAIR_OR_TRANSLATOR'
# 'CO_INVESTIGATOR'
# 'CO_INVENTOR'
# 'GRADUATE_STUDENT'
# 'OTHER_INVENTOR'
# 'PRINCIPAL_INVESTIGATOR'
# 'POSTDOCTORAL_RESEARCHER'
# 'SUPPORT_STAFF'
'contributor-role': 'SUPPORT_STAFF',
# One of 'ADDITIONAL', 'FIRST'
'contributor-sequence': 'ADDITIONAL'
}
}]},
# ISO-629-1: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
'language-code': 'en',
'country': {'value': 'US', 'visibility': 'PUBLIC'}
},
"journal-title": {
"value": "journal # 1"
},
"type": "JOURNAL_ARTICLE",
"external-ids": {
"external-id": [{
"external-id-type": "doi",
"external-id-value": "next-id-2",
"external-id-url": {
"value": "http://dx.doi.org/ext-id-1"
},
"external-id-relationship": "SELF"
}]
}
}

6 changes: 3 additions & 3 deletions orcid/testsuite/test_orcid.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_search_public_generator(publicAPI):
result = next(generator)
# Just check if the request suceeded

assert result['relevancy-score']['value'] > 0
assert 'orcid-identifier' in result


def test_search_public_generator_no_results(publicAPI):
Expand All @@ -137,7 +137,7 @@ def test_search_public_generator_pagination(publicAPI):
result = next(generator)
# Just check if the request suceeded

assert result['relevancy-score']['value'] > 0
assert 'orcid-identifier' in result


@pytest.fixture
Expand All @@ -163,7 +163,7 @@ def test_search_member_generator(memberAPI):
"""Test search_member with generator."""
generator = memberAPI.search_generator('text:%s' % WORK_NAME)
results = next(generator)
assert results['result'][0]['orcid-identifier']['path'] == USER_ORCID
assert results['orcid-identifier']['path'] == USER_ORCID


def test_read_record_member(memberAPI):
Expand Down

0 comments on commit 477be7e

Please sign in to comment.