#5355 Ensure the url we redirect to are full URLs
Merged by ngompa. Opened by pingou.
fix_redirect  into  master

Download 5355.patch
no initial comment

Looks like we have three failures?

13:35:57  FAILED tests/test_pagure_flask_ui_login.py::PagureFlaskLogintests::test_settings_admin_session_timedout
13:35:57  FAILED tests/test_style.py::TestStyle::test_code_with_black - AssertionError:...
13:35:57  FAILED tests/test_style.py::TestStyle::test_code_with_flake8 - AssertionError...

rebased onto 417b6e8d4ab6ebde31236d96e310f4fcbf36c32b

Just fixed one missing import in ui/issues.py

I have another branch (and thus another PR) adding support for isort and making black and flake8 happy

rebased onto 96da476aafda3ee67b4c4ffb9578149113f67459

Two failures currently:

08:17:44  FAILED tests/test_pagure_flask_ui_login.py::PagureFlaskLogintests::test_settings_admin_session_timedout
08:17:44  FAILED tests/test_style.py::TestStyle::test_code_with_black - AssertionError:...

The black failure is pretty easy to fix at least.

Running black locally shows me nothing:

$ git log -1
commit c0b92441ea78a4666148a514394d28366dfd2376 (HEAD -> fix_redirect, origin/fix_redirect)
Author: Pierre-Yves Chibon <pingou@pingoured.fr>
Date:   Wed Jan 4 14:01:14 2023 +0100
    Make black happy
    Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
$ black -l 79 pagure/ tests/
All done!  🍰 75 files left unchanged.

rebased onto 417b6e8d4ab6ebde31236d96e310f4fcbf36c32b

rebased onto e05c2a23df5a9bf8c71f7ac046e22b8f37301a73

fixed the black error from jenkins' output

So now all that's left is the one test failure:

03:53:44  __________ PagureFlaskLogintests.test_settings_admin_session_timedout __________
03:53:44  [gw0] linux -- Python 3.9.13 /usr/bin/python3
03:53:44  
03:53:44  self = <tests.test_pagure_flask_ui_login.PagureFlaskLogintests testMethod=test_settings_admin_session_timedout>
03:53:44  
03:53:44      @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"})
03:53:44      def test_settings_admin_session_timedout(self):
03:53:44          """Test the admin_session_timedout with settings endpoint."""
03:53:44          lifetime = pagure.config.config.get(
03:53:44              "ADMIN_SESSION_LIFETIME", datetime.timedelta(minutes=15)
03:53:44          )
03:53:44          td1 = datetime.timedelta(minutes=1)
03:53:44          # session already expired
03:53:44          user = tests.FakeUser(username="foo")
03:53:44          user.login_time = datetime.datetime.utcnow() - lifetime - td1
03:53:44          with tests.user_set(self.app.application, user):
03:53:44              # not following the redirect because user_set contextmanager
03:53:44              # will run again for the login page and set back the user
03:53:44              # which results in a loop, since admin_session_timedout will
03:53:44              # redirect again for the login page
03:53:44              output = self.app.get("/settings/")
03:53:44              self.assertEqual(output.status_code, 302)
03:53:44  >           self.assertTrue(
03:53:44                  output.location
03:53:44                  in (
03:53:44                      "http://localhost/login/",
03:53:44                      "/login/?next=http%3A%2F%2Flocalhost%2Fsettings%2F",
03:53:44                  )
03:53:44              )
03:53:44  E           AssertionError: False is not true
03:53:44  
03:53:44  tests/test_pagure_flask_ui_login.py:1100: AssertionError

rebased onto b511b88948480def7aec75aa8253b11ffb842ed1

2 new commits added

  • Fix unit-tests
  • Ensure the url we redirect to are full URLs

The pip tests failed, but the other env passed :)

Pull-Request has been merged by ngompa

The pip tests failed, but the other env passed :)

I really don't understand why the pip tests are so broken...

Metadata