-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
670d487
commit 7eb327c
Showing
27 changed files
with
1,401 additions
and
9 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 |
---|---|---|
|
@@ -26,3 +26,5 @@ | |
@bold: 700; | ||
|
||
@headerFontWeight: @semibold; | ||
|
||
@cover-panel-padding: 40px; |
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,59 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2022 CERN. | ||
# | ||
# invenio-administration is free software; you can redistribute it and/or | ||
# modify it under the terms of the MIT License; see LICENSE file for more | ||
# details. | ||
"""Pytest fixtures.""" | ||
|
||
from collections import namedtuple | ||
|
||
import pytest | ||
from invenio_app.factory import create_api as _create_api | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def app_config(app_config): | ||
"""Mimic an instance's configuration.""" | ||
return app_config | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def create_app(instance_path, entry_points): | ||
"""Application factory fixture.""" | ||
return _create_api | ||
|
||
|
||
RunningApp = namedtuple( | ||
"RunningApp", | ||
[ | ||
"app", | ||
"location", | ||
"cache", | ||
], | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def running_app( | ||
app, | ||
location, | ||
cache, | ||
): | ||
"""Fixture provides an app with the typically needed db data loaded. | ||
All of these fixtures are often needed together, so collecting them | ||
under a semantic umbrella makes sense. | ||
""" | ||
return RunningApp( | ||
app, | ||
location, | ||
cache, | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def test_app(running_app): | ||
"""Get current app.""" | ||
return running_app.app |
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,8 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2022 CERN. | ||
# | ||
# invenio-administration is free software; you can redistribute it and/or | ||
# modify it under the terms of the MIT License; see LICENSE file for more | ||
# details. | ||
"""Pytest fixtures.""" |
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,91 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2022 CERN. | ||
# | ||
# invenio-administration is free software; you can redistribute it and/or | ||
# modify it under the terms of the MIT License; see LICENSE file for more | ||
# details. | ||
"""Test support contact form.""" | ||
|
||
import pytest | ||
from marshmallow import ValidationError | ||
|
||
from zenodo_rdm.support.support import ZenodoSupport | ||
|
||
|
||
@pytest.fixture | ||
def support_view(): | ||
return ZenodoSupport() | ||
|
||
|
||
@pytest.fixture | ||
def support_email_service(support_view): | ||
return support_view.email_service | ||
|
||
|
||
@pytest.fixture | ||
def form_json_data(): | ||
return { | ||
"name": "John Doe", | ||
"email": "[email protected]", | ||
"category": "file-modification", | ||
"description": "Hi! I need some help with my record ...", | ||
"subject": "Record file is wrong", | ||
"sysInfo": False, | ||
"files": [], | ||
} | ||
|
||
|
||
def test_endpoints(): | ||
pass | ||
|
||
|
||
def test_form_handler(support_view): | ||
# TODO | ||
# support_view.handle_form() | ||
pass | ||
|
||
|
||
def test_form_validation_valid(form_json_data, support_view, test_app): | ||
"""Tests form with valid data.""" | ||
validated_data = support_view.validate_form(form_json_data) | ||
assert validated_data | ||
assert type(validated_data) == dict | ||
assert validated_data == form_json_data | ||
|
||
|
||
def test_form_validation_invalid_unknown_fields(form_json_data, support_view): | ||
"""Tests invalid form with unknown fields.""" | ||
invalid_data = {**form_json_data, "unknown": "Unknown field"} | ||
with pytest.raises(ValidationError): | ||
support_view.validate_form(invalid_data) | ||
|
||
|
||
def test_form_validation_invalid_description(form_json_data, support_view, test_app): | ||
"""Tests form with invalid description.""" | ||
min_length = test_app.config["SUPPORT_DESCRIPTION_MIN_LENGTH"] | ||
# Small description should fail | ||
invalid_data = {**form_json_data, "description": "a" * (min_length - 1)} | ||
with pytest.raises(ValidationError): | ||
support_view.validate_form(invalid_data) | ||
|
||
max_length = test_app.config["SUPPORT_DESCRIPTION_MAX_LENGTH"] | ||
# Large description should fail | ||
invalid_data = {**form_json_data, "description": "a" * (max_length + 1)} | ||
with pytest.raises(ValidationError): | ||
support_view.validate_form(invalid_data) | ||
|
||
|
||
def test_form_validation_invalid_categories(form_json_data, support_view): | ||
"""Tests form with invalid category.""" | ||
# Invalid category should fail | ||
invalid_data = {**form_json_data, "category": "invalid-category"} | ||
with pytest.raises(ValidationError): | ||
support_view.validate_form(invalid_data) | ||
|
||
|
||
def test_form_validation_invalid_required_fields(form_json_data, support_view): | ||
"""Tests form with missing required field.""" | ||
invalid_data = {**form_json_data, "name": None} | ||
with pytest.raises(ValidationError): | ||
support_view.validate_form(invalid_data) |
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 @@ | ||
__version__ = '0.0.0' |
116 changes: 116 additions & 0 deletions
116
site/zenodo_rdm/assets/semantic-ui/js/zenodo_rdm/src/support/categories.js
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,116 @@ | ||
export default categories = [ | ||
{ | ||
'key': 'file-modification', | ||
'title': 'File modification', | ||
'description': ( | ||
'All requests related to updating files in already published ' | ||
'record(s). This includes new file addition, file removal or ' | ||
'file replacement. ' | ||
'Before sending a request, please consider creating a ' | ||
'<a href="http://help.zenodo.org/#versioning">new version</a> ' | ||
'of your upload. Please first consult our ' | ||
'<a href="http://help.zenodo.org/#general">FAQ</a> to get familiar' | ||
' with the file update conditions, to see if your case is ' | ||
'eligible.<br /><br />' | ||
'You request has to contain <u>all</u> of the points below:' | ||
'<ol>' | ||
'<li>Provide a justification for the file change in the ' | ||
'description.</li>' | ||
'<li>Mention any use of the record(s) DOI in publications or ' | ||
'online, e.g.: list papers that cite your record and ' | ||
'provide links to posts on blogs and social media. ' | ||
'Otherwise, state that to the best of your knowledge the DOI has ' | ||
'not been used anywhere.</li>' | ||
'<li>Specify the record(s) you want to update <u>by the Zenodo' | ||
' URL</u>, e.g.: "https://zenodo.org/record/8428".<br />' | ||
"<u>Providing only the record's title, publication date or a " | ||
"screenshot with search result is not explicit enough</u>.</li>" | ||
'<li>If you want to delete or update a file, specify it ' | ||
'<u>by its filename</u>, and mention if you want the name to ' | ||
'remain as is or changed (by default the filename of the new ' | ||
'file will be used).</li>' | ||
'<li>Upload the new files below or provide a publicly-accessible ' | ||
'URL(s) with the files in the description.</li>' | ||
'</ol>' | ||
'<b><u>Not providing full information on any of the points above ' | ||
'will significantly slow down your request resolution</u></b>, ' | ||
'since our support staff will have to reply back with a request ' | ||
'for missing information.' | ||
), | ||
}, | ||
{ | ||
'key': 'upload-quota', | ||
'title': 'File upload quota increase', | ||
'description': ( | ||
'All requests for a quota increase beyond the 50GB limit. ' | ||
'Please include the following information with your request:' | ||
'<ol>' | ||
'<li>The total size of your dataset, number of files and the ' | ||
'largest file in the dataset. When referring to file sizes' | ||
' use <a href="https://en.wikipedia.org/wiki/IEEE_1541-2002">' | ||
'SI units</a></li>' | ||
'<li>Information related to the organization, project or grant ' | ||
'which was involved in the research, which produced the ' | ||
'dataset.</li>' | ||
'<li>Information on the currently in-review or future papers that ' | ||
'will cite this dataset (if applicable). If possible specify the ' | ||
'journal or conference.</li>' | ||
'</ol>' | ||
), | ||
}, | ||
{ | ||
'key': 'record-inactivation', | ||
'title': 'Record inactivation', | ||
'description': ( | ||
'Requests related to record inactivation, either by the record ' | ||
'owner or a third party. Please specify the record(s) in question ' | ||
'by the URL(s), and reason for the inactivation.' | ||
), | ||
}, | ||
{ | ||
'key': 'openaire', | ||
'title': 'OpenAIRE', | ||
'description': ( | ||
'All questions related to OpenAIRE reporting and grants. ' | ||
'Before sending a request, make sure your problem was not ' | ||
'already resolved, see OpenAIRE ' | ||
'<a href="https://www.openaire.eu/faqs">FAQ</a>. ' | ||
'For questions unrelated to Zenodo, you should contact OpenAIRE ' | ||
'<a href="https://www.openaire.eu/support/helpdesk">' | ||
'helpdesk</a> directly.' | ||
), | ||
}, | ||
{ | ||
'key': 'partnership', | ||
'title': 'Partnership, outreach and media', | ||
'description': ( | ||
'All questions related to possible partnerships, outreach, ' | ||
'invited talks and other official inquiries by media.' | ||
'If you are a journal, organization or conference organizer ' | ||
'interested in using Zenodo as archive for your papers, software ' | ||
'or data, please provide details for your usecase.' | ||
), | ||
}, | ||
{ | ||
'key': 'tech-support', | ||
'title': 'Security issue, bug or spam report', | ||
'description': ( | ||
'Report a technical issue or a spam content on Zenodo.' | ||
'Please provide details on how to reproduce the bug. ' | ||
'Upload any screenshots or files which are relevant to the issue ' | ||
'or to means of reproducing it. Include error messages and ' | ||
'error codes you might be getting in the description.<br /> ' | ||
'For REST API errors, provide a minimal code which produces the ' | ||
'issues. Use external services for scripts and long text' | ||
', e.g.: <a href="https://gist.github.com/">GitHub Gist</a>. ' | ||
'<strong>Do not disclose your password or REST API access tokens.' | ||
'</strong>' | ||
), | ||
}, | ||
{ | ||
'key': 'other', | ||
'title': 'Other', | ||
'description': ( | ||
'Questions which do not fit into any other category.'), | ||
}, | ||
]; |
Oops, something went wrong.