|
11 | 11 | from os import close, remove |
12 | 12 | from os.path import basename, exists, relpath |
13 | 13 | from json import loads |
| 14 | +from mock import Mock |
14 | 15 |
|
15 | 16 | from tornado.web import HTTPError |
16 | 17 |
|
|
23 | 24 | from qiita_db.software import Parameters, Command |
24 | 25 | from qiita_pet.exceptions import QiitaHTTPError |
25 | 26 | from qiita_pet.test.tornado_test_base import TestHandlerBase |
| 27 | +from qiita_pet.handlers.base_handlers import BaseHandler |
26 | 28 | from qiita_pet.handlers.artifact_handlers.base_handlers import ( |
27 | 29 | check_artifact_access, artifact_summary_get_request, |
28 | 30 | artifact_summary_post_request, artifact_patch_request, |
@@ -430,6 +432,14 @@ def test_get_artifact_summary_handler(self): |
430 | 432 | self.assertEqual(response.body.decode('ascii'), |
431 | 433 | '<b>HTML TEST - not important</b>\n') |
432 | 434 |
|
| 435 | + # testing with a not log user should return the login page |
| 436 | + BaseHandler.get_current_user = Mock(return_value=None) |
| 437 | + response = self.get('/artifact/html_summary/%s' % summary) |
| 438 | + self.assertEqual(response.code, 200) |
| 439 | + exp = ('<button tabindex="3" type="submit" class="btn btn-success">' |
| 440 | + 'Sign in</button>') |
| 441 | + self.assertIn(exp, response.body.decode()) |
| 442 | + |
433 | 443 |
|
434 | 444 | if __name__ == '__main__': |
435 | 445 | main() |
0 commit comments