#219 Redirect the user to the page they are viewing after logging in
Merged by pingou. Opened by pingou.
pingou/fedora-hubs fix_login  into  develop

Download 219.patch
no initial comment

This works for me

:thumbsup: good to merge after rebase


edit

Forgot to mention that the unittests don't pass

FAIL: test_hub_logged_out (hubs.tests.test_fedora_hubs_flask_api.HubsAPITest)
Traceback (most recent call last):
  File "/home/skrzepto/Documents/pull_request_review/fedora-hubs/hubs/tests/test_fedora_hubs_flask_api.py", line 48, in test_hub_logged_out
    self.assertTrue(str_expected in result.data)
AssertionError: False is not true

working on a patch now

diff --git a/hubs/tests/test_fedora_hubs_flask_api.py b/hubs/tests/test_fedora_hubs_flask_api.py \n    
index 7b7dbff..2a7f563 100644
--- a/hubs/tests/test_fedora_hubs_flask_api.py
+++ b/hubs/tests/test_fedora_hubs_flask_api.py
@@ -34,19 +34,15 @@ class HubsAPITest(hubs.tests.APPTest):
                              '/login">login</a>' in result.data)
    def test_hub_logged_out(self):
  -        with app.test_request_context('/ralph'):
  -            import flask
  -            flask.g.oidc_id_token = None
  -            # need to manually call the @app.before_request
  -            # since unittest don't call it
  -            hubs.app.check_auth()
  +        with tests.auth_set(app, None):  # check_auth doesn't load in unittest
                result = self.app.get('/ralph', follow_redirects=True)
  -            # assert the status code of the response
               self.assertEqual(result.status_code, 200)
  -            str_expected = 'Not logged in.  Click to ' \
  -                           '<a href="/login">login</a>'
  +            str_expected = '<h5>Ralph</h5>'
  +            self.assertTrue(str_expected in result.data)
  +            str_expected = 'Not logged in.'
               self.assertTrue(str_expected in result.data)

After discussing with @atelic in order for @skrzepto to keep the authorship of his work, we decided to merge this PR as is (well rebased) and let @skrzepto do a PR later to fix the tests :)

rebased

Pull-Request has been merged by pingou

Metadata