Skip to content
Permalink
Browse files

Merge pull request #722 from Royal-Society-of-New-Zealand/prod

Prod
  • Loading branch information...
rpaw053 committed Aug 7, 2019
2 parents b83143d + d168ffb commit 4a1ddbf674c89d3fa5699ef7777d364a908b43f7
Showing with 3,584 additions and 2,857 deletions.
  1. +12 −4 .travis.yml
  2. +1 −1 Makefile
  3. +1 −1 dev_requirements.txt
  4. +6 −4 docker-compose.yml
  5. +181 −1 orcid_api_v3/api/development_member_api_v3_0_api.py
  6. +4 −3 orcid_api_v3/models/address_v30.py
  7. +2 −2 orcid_api_v3/models/citation.py
  8. +3 −3 orcid_api_v3/models/contributor_attributes_v30.py
  9. +7 −4 orcid_api_v3/models/distinction_v30.py
  10. +7 −4 orcid_api_v3/models/education_v30.py
  11. +7 −4 orcid_api_v3/models/employment_v30.py
  12. +2 −2 orcid_api_v3/models/external_idv30.py
  13. +3 −2 orcid_api_v3/models/funding_contributor_attributes_v30.py
  14. +11 −6 orcid_api_v3/models/funding_v30.py
  15. +7 −4 orcid_api_v3/models/invited_position_v30.py
  16. +2 −2 orcid_api_v3/models/keyword_v30.py
  17. +7 −4 orcid_api_v3/models/membership_v30.py
  18. +2 −2 orcid_api_v3/models/other_name_v30.py
  19. +9 −7 orcid_api_v3/models/peer_review_v30.py
  20. +7 −5 orcid_api_v3/models/person_external_identifier_v30.py
  21. +7 −4 orcid_api_v3/models/qualification_v30.py
  22. +2 −2 orcid_api_v3/models/research_resource_v30.py
  23. +2 −2 orcid_api_v3/models/researcher_url_v30.py
  24. +7 −4 orcid_api_v3/models/service_v30.py
  25. +4 −3 orcid_api_v3/models/work_v30.py
  26. +8 −8 orcid_hub/__init__.py
  27. +121 −52 orcid_hub/apis.py
  28. +23 −17 orcid_hub/authcontroller.py
  29. +1 −31 orcid_hub/data_apis.py
  30. +52 −47 orcid_hub/forms.py
  31. +4 −2 orcid_hub/mocks/__init__.py
  32. +7 −0 orcid_hub/mocks/webhook_handler.py
  33. +503 −432 orcid_hub/models.py
  34. +10 −17 orcid_hub/oauth.py
  35. +598 −474 orcid_hub/orcid_client.py
  36. +9 −3 orcid_hub/schemas.py
  37. +9 −6 orcid_hub/sql/auditing.sql
  38. +8 −0 orcid_hub/templates/admin/member_edit.html
  39. +5 −5 orcid_hub/templates/admin/user_edit.html
  40. +11 −0 orcid_hub/templates/affiliation_record_list.html
  41. 0 orcid_hub/templates/email/{person_update_invitation.html → property_invitation.html}
  42. +7 −1 orcid_hub/templates/form.html
  43. +0 −83 orcid_hub/templates/funding_section.html
  44. +8 −3 orcid_hub/templates/header.html
  45. +34 −1 orcid_hub/templates/macros.html
  46. +0 −81 orcid_hub/templates/peer_review_section.html
  47. +11 −4 orcid_hub/templates/profile_entry.html
  48. +105 −29 orcid_hub/templates/section.html
  49. +10 −14 orcid_hub/templates/viewMembers.html
  50. +0 −78 orcid_hub/templates/work_section.html
  51. +244 −256 orcid_hub/utils.py
  52. +290 −342 orcid_hub/views.py
  53. +41 −5 requirements.txt
  54. +79 −47 tests/conftest.py
  55. +199 −116 tests/test_apis.py
  56. +86 −84 tests/test_batch.py
  57. +6 −0 tests/test_forms.py
  58. +4 −4 tests/test_main.py
  59. +23 −37 tests/test_models.py
  60. +78 −21 tests/test_orcid.py
  61. +53 −46 tests/test_utils.py
  62. +359 −247 tests/test_views.py
  63. +123 −11 tests/test_webhooks.py
  64. +152 −173 tests/utils.py
@@ -14,11 +14,16 @@ before_install:

install:
- gen-keys/genkey.sh $DOMAIN
- ls -l
- openssl genrsa -out .keys/dkim.key 1024
- for t in sp server; do cp build-server.key .keys/${ENV}-$t.key; cp build-server.crt .keys/${ENV}-$t.crt; done
- mkdir -p pgdata data/redis archive backup
- export UID
- docker-compose up -d
# Wait for containers get started...
- for t in {1..40}; do (docker-compose ps app | grep -q ' Up ') && break ; sleep 1; done

before_script:
- docker-compose exec app coverage erase

script:
- wait_pg_up() { until docker-compose exec db psql -U postgres -l; do echo "Waiting for postgres to start..."; sleep 1; done }
@@ -29,15 +34,18 @@ script:
- docker-compose exec db psql -U orcidhub -d orcidhub -c "SELECT 1" && echo "DB orcidhub IS RUNNING"
- docker-compose exec app curl -k -s https://localhost/pyinfo -o /dev/null && echo "WSGI is working..."
- docker-compose exec app w3c_validator https://localhost https://localhost/about https://localhost/faq
- touch .keys/dkim.key
- docker-compose exec app ./pytest.sh
- docker-compose logs app

after_success:
- echo "*** Deploying from $(curl ipv4.icanhazip.com)"
- docker-compose exec app coverage report
- docker-compose exec app coveralls
- docker-compose exec app python3.6 ./setup.py sdist
- docker-compose exec app twine upload -u "$PYPI_USER" -p "$PYPI_PASSWORD" --skip-existing dist/*
- |
if [[ $TRAVIS_COMMIT_MESSAGE == *"[PUBLISH]"* ]] ; then
docker-compose exec app python3.6 ./setup.py sdist
docker-compose exec app twine upload -u "$PYPI_USER" -p "$PYPI_PASSWORD" --skip-existing dist/*
fi
- eval "$(ssh-agent -s)"
- openssl rsa -in .travis/.deploy.key -out .travis/deploy.key -passin env:DEPLOY_KEY_PASSPHRASE
- chmod 400 .travis/deploy.key
@@ -1,5 +1,5 @@
NAME = orcidhub/app
VERSION = 5.1
VERSION = 6.4

.PHONY: all build test tag

@@ -15,7 +15,7 @@ isort>=4.2.15
mccabe>=0.6.1
pep8-naming>=0.4.1
pydocs>=0.2
pydocstyle>=2.0.0
pydocstyle>=2.0.0,<4.0.0
Pygments>=2.2.0
pytest<3.7.0
pytest-cov>=2.5.1
@@ -3,7 +3,7 @@ version: '3.5'
services:

db:
image: postgres:11.3
image: postgres:11.4
environment:
- PGPASSWORD
- POSTGRES_PASSWORD="${PGPASSWORD:-p455w0rd}"
@@ -25,7 +25,7 @@ services:
depends_on:
- db
- redis
image: orcidhub/app-dev
image: orcidhub/app-dev:6.3
environment:
- ENV
# - SHIB_SP_DOMAINNAME
@@ -65,7 +65,7 @@ services:
ipv4_address: ${SUBNET:-172.33}.0.88

worker:
image: orcidhub/app-dev
image: orcidhub/app-dev:6.3
depends_on:
- redis
- db
@@ -74,18 +74,20 @@ services:
- ENV
- MAIL_DEFAULT_SENDER
- SECRET_KEY
- SENTRY_DSN
volumes:
- .:/src
restart: always

scheduler:
image: orcidhub/app-dev
image: orcidhub/app-dev:6.3
depends_on:
- redis
- db
command: ["./scheduler.sh"]
environment:
- ENV
- SENTRY_DSN
volumes:
- .:/src
restart: always

Large diffs are not rendered by default.

@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -71,7 +71,8 @@ def __init__(self, created_date=None, last_modified_date=None, source=None, coun
self.last_modified_date = last_modified_date
if source is not None:
self.source = source
self.country = country
if country is not None:
self.country = country
if visibility is not None:
self.visibility = visibility
if path is not None:
@@ -185,7 +186,7 @@ def visibility(self, visibility):
:param visibility: The visibility of this AddressV30. # noqa: E501
:type: str
"""
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE"] # noqa: E501
allowed_values = [c.replace('_', '-').lower() for c in ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE"]] # noqa: E501
if visibility not in allowed_values:
raise ValueError(
"Invalid value for `visibility` ({0}), must be one of {1}" # noqa: E501
@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -66,7 +66,7 @@ def citation_type(self, citation_type):
"""
if citation_type is None:
raise ValueError("Invalid value for `citation_type`, must not be `None`") # noqa: E501
allowed_values = ["FORMATTED_UNSPECIFIED", "BIBTEX", "FORMATTED_APA", "FORMATTED_HARVARD", "FORMATTED_IEEE", "FORMATTED_MLA", "FORMATTED_VANCOUVER", "FORMATTED_CHICAGO", "RIS"] # noqa: E501
allowed_values = [c.replace('_', '-').lower() for c in ["FORMATTED_UNSPECIFIED", "BIBTEX", "FORMATTED_APA", "FORMATTED_HARVARD", "FORMATTED_IEEE", "FORMATTED_MLA", "FORMATTED_VANCOUVER", "FORMATTED_CHICAGO", "RIS"]] # noqa: E501
if citation_type not in allowed_values:
raise ValueError(
"Invalid value for `citation_type` ({0}), must be one of {1}" # noqa: E501
@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -66,7 +66,7 @@ def contributor_sequence(self, contributor_sequence):
"""
if contributor_sequence is None:
raise ValueError("Invalid value for `contributor_sequence`, must not be `None`") # noqa: E501
allowed_values = ["FIRST", "ADDITIONAL"] # noqa: E501
allowed_values = ["FIRST", "ADDITIONAL", "first", "additional"] # noqa: E501
if contributor_sequence not in allowed_values:
raise ValueError(
"Invalid value for `contributor_sequence` ({0}), must be one of {1}" # noqa: E501
@@ -95,7 +95,7 @@ def contributor_role(self, contributor_role):
"""
if contributor_role is None:
raise ValueError("Invalid value for `contributor_role`, must not be `None`") # noqa: E501
allowed_values = ["AUTHOR", "ASSIGNEE", "EDITOR", "CHAIR_OR_TRANSLATOR", "CO_INVESTIGATOR", "CO_INVENTOR", "GRADUATE_STUDENT", "OTHER_INVENTOR", "PRINCIPAL_INVESTIGATOR", "POSTDOCTORAL_RESEARCHER", "SUPPORT_STAFF"] # noqa: E501
allowed_values = [c.replace('_', '-').lower() for c in ["AUTHOR", "ASSIGNEE", "EDITOR", "CHAIR_OR_TRANSLATOR", "CO_INVESTIGATOR", "CO_INVENTOR", "GRADUATE_STUDENT", "OTHER_INVENTOR", "PRINCIPAL_INVESTIGATOR", "POSTDOCTORAL_RESEARCHER", "SUPPORT_STAFF"]] # noqa: E501
if contributor_role not in allowed_values:
raise ValueError(
"Invalid value for `contributor_role` ({0}), must be one of {1}" # noqa: E501
@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -100,10 +100,12 @@ def __init__(self, created_date=None, last_modified_date=None, source=None, put_
self.department_name = department_name
if role_title is not None:
self.role_title = role_title
self.start_date = start_date
if start_date is not None:
self.start_date = start_date
if end_date is not None:
self.end_date = end_date
self.organization = organization
if organization is not None:
self.organization = organization
if url is not None:
self.url = url
if external_ids is not None:
@@ -408,7 +410,8 @@ def visibility(self, visibility):
:param visibility: The visibility of this DistinctionV30. # noqa: E501
:type: str
"""
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE"] # noqa: E501
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE", "public", "private",
"limited", "registered-only"] # noqa: E501
if visibility not in allowed_values:
raise ValueError(
"Invalid value for `visibility` ({0}), must be one of {1}" # noqa: E501
@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -100,10 +100,12 @@ def __init__(self, created_date=None, last_modified_date=None, source=None, put_
self.department_name = department_name
if role_title is not None:
self.role_title = role_title
self.start_date = start_date
if start_date is not None:
self.start_date = start_date
if end_date is not None:
self.end_date = end_date
self.organization = organization
if organization is not None:
self.organization = organization
if url is not None:
self.url = url
if external_ids is not None:
@@ -408,7 +410,8 @@ def visibility(self, visibility):
:param visibility: The visibility of this EducationV30. # noqa: E501
:type: str
"""
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE"] # noqa: E501
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE", "public", "private",
"limited", "registered-only"] # noqa: E501
if visibility not in allowed_values:
raise ValueError(
"Invalid value for `visibility` ({0}), must be one of {1}" # noqa: E501
@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -100,10 +100,12 @@ def __init__(self, created_date=None, last_modified_date=None, source=None, put_
self.department_name = department_name
if role_title is not None:
self.role_title = role_title
self.start_date = start_date
if start_date is not None:
self.start_date = start_date
if end_date is not None:
self.end_date = end_date
self.organization = organization
if organization is not None:
self.organization = organization
if url is not None:
self.url = url
if external_ids is not None:
@@ -408,7 +410,8 @@ def visibility(self, visibility):
:param visibility: The visibility of this EmploymentV30. # noqa: E501
:type: str
"""
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE"] # noqa: E501
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE", "public", "private",
"limited", "registered-only"] # noqa: E501
if visibility not in allowed_values:
raise ValueError(
"Invalid value for `visibility` ({0}), must be one of {1}" # noqa: E501
@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -196,7 +196,7 @@ def external_id_relationship(self, external_id_relationship):
:param external_id_relationship: The external_id_relationship of this ExternalIDV30. # noqa: E501
:type: str
"""
allowed_values = ["PART_OF", "SELF", "VERSION_OF"] # noqa: E501
allowed_values = ["PART_OF", "SELF", "VERSION_OF", "part-of", "self", ] # noqa: E501
if external_id_relationship not in allowed_values:
raise ValueError(
"Invalid value for `external_id_relationship` ({0}), must be one of {1}" # noqa: E501
@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -62,7 +62,8 @@ def contributor_role(self, contributor_role):
"""
if contributor_role is None:
raise ValueError("Invalid value for `contributor_role`, must not be `None`") # noqa: E501
allowed_values = ["LEAD", "CO_LEAD", "SUPPORTED_BY", "OTHER_CONTRIBUTION"] # noqa: E501
allowed_values = ["LEAD", "CO_LEAD", "SUPPORTED_BY", "OTHER_CONTRIBUTION", "lead",
"co-lead", "supported-by", "other-contribution"] # noqa: E501
if contributor_role not in allowed_values:
raise ValueError(
"Invalid value for `contributor_role` ({0}), must be one of {1}" # noqa: E501
@@ -6,7 +6,7 @@
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

@@ -109,10 +109,12 @@ def __init__(self, created_date=None, last_modified_date=None, source=None, put_
self.put_code = put_code
if path is not None:
self.path = path
self.type = type
if type is not None:
self.type = type
if organization_defined_type is not None:
self.organization_defined_type = organization_defined_type
self.title = title
if title is not None:
self.title = title
if short_description is not None:
self.short_description = short_description
if amount is not None:
@@ -127,7 +129,8 @@ def __init__(self, created_date=None, last_modified_date=None, source=None, put_
self.external_ids = external_ids
if contributors is not None:
self.contributors = contributors
self.organization = organization
if organization is not None:
self.organization = organization
if visibility is not None:
self.visibility = visibility

@@ -256,7 +259,8 @@ def type(self, type):
"""
if type is None:
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501
allowed_values = ["GRANT", "CONTRACT", "AWARD", "SALARY_AWARD"] # noqa: E501
allowed_values = ["GRANT", "CONTRACT", "AWARD", "SALARY_AWARD", "grant", "contract", "award",
"salary-award"] # noqa: E501
if type not in allowed_values:
raise ValueError(
"Invalid value for `type` ({0}), must be one of {1}" # noqa: E501
@@ -497,7 +501,8 @@ def visibility(self, visibility):
:param visibility: The visibility of this FundingV30. # noqa: E501
:type: str
"""
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE"] # noqa: E501
allowed_values = ["LIMITED", "REGISTERED_ONLY", "PUBLIC", "PRIVATE", "public", "private",
"limited", "registered-only"] # noqa: E501
if visibility not in allowed_values:
raise ValueError(
"Invalid value for `visibility` ({0}), must be one of {1}" # noqa: E501

0 comments on commit 4a1ddbf

Please sign in to comment.
You can’t perform that action at this time.