Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/weko-records-ui/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,15 @@ def side_effect(arg):
restricted_errorMsg = {"content_file_download": {"expiration_date": 30,"expiration_date_unlimited_chk": False,"download_limit": 10,"download_limit_unlimited_chk": False,},"usage_report_workflow_access": {"expiration_date_access": 500,"expiration_date_access_unlimited_chk": False,},"terms_and_conditions": [],"error_msg":{"key" : "","content" : {"ja" : {"content" : "このデータは利用できません(権限がないため)。"},"en":{"content" : "This data is not available for this user"}}}}
with patch('weko_admin.utils.get_restricted_access' ,return_value = restricted_errorMsg):
assert default_view_method(recid, record ,'helloworld.pdf').status_code == 200

with patch('weko_records_ui.views.current_i18n') as mock_i18n:
mock_i18n.language = 'vi'
with patch('weko_admin.utils.get_restricted_access', return_value=restricted_errorMsg):
with patch('weko_records_ui.views.render_template') as mock_render_template:
mock_render_template.return_value = 'dummy_response'
response = default_view_method(recid, record, 'helloworld.pdf')
kwargs = mock_render_template.call_args.kwargs
assert kwargs['restricted_errorMsg'] == "This data is not available for this user"

with patch('weko_records_ui.views.AdminSettings.get'
, side_effect=lambda name , dict_to_object : {'password_enable' : True,"terms_and_conditions":""} if name == 'restricted_access' else None):
Expand Down
Loading