Skip to content

Commit

Permalink
Merge pull request #3155 from antgonza/fix-3150
Browse files Browse the repository at this point in the history
fix #3150
  • Loading branch information
charles-cowart authored Oct 18, 2021
2 parents 7e8df20 + 7fdf51f commit 331293c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions qiita_pet/handlers/artifact_handlers/base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ def patch(self, artifact_id):


class ArtifactSummaryHandler(StaticFileHandler, BaseHandler):
@authenticated
def validate_absolute_path(self, root, absolute_path):
"""Overrides StaticFileHandler's method to include authentication"""
user = self.current_user
Expand Down
10 changes: 10 additions & 0 deletions qiita_pet/handlers/artifact_handlers/tests/test_base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from os import close, remove
from os.path import basename, exists, relpath
from json import loads
from mock import Mock

from tornado.web import HTTPError

Expand All @@ -23,6 +24,7 @@
from qiita_db.software import Parameters, Command
from qiita_pet.exceptions import QiitaHTTPError
from qiita_pet.test.tornado_test_base import TestHandlerBase
from qiita_pet.handlers.base_handlers import BaseHandler
from qiita_pet.handlers.artifact_handlers.base_handlers import (
check_artifact_access, artifact_summary_get_request,
artifact_summary_post_request, artifact_patch_request,
Expand Down Expand Up @@ -430,6 +432,14 @@ def test_get_artifact_summary_handler(self):
self.assertEqual(response.body.decode('ascii'),
'<b>HTML TEST - not important</b>\n')

# testing with a not log user should return the login page
BaseHandler.get_current_user = Mock(return_value=None)
response = self.get('/artifact/html_summary/%s' % summary)
self.assertEqual(response.code, 200)
exp = ('<button tabindex="3" type="submit" class="btn btn-success">'
'Sign in</button>')
self.assertIn(exp, response.body.decode())


if __name__ == '__main__':
main()

0 comments on commit 331293c

Please sign in to comment.