| |
@@ -474,6 +474,10 @@
|
| |
'<span class="d-none d-md-inline">Settings</span>', output_text
|
| |
)
|
| |
|
| |
+ output = self.app.get("/login/?next=%2f%2f%09%2fgoogle.fr")
|
| |
+ self.assertEqual(output.status_code, 302)
|
| |
+ self.assertEqual(output.location, "http://localhost/google.fr")
|
| |
+
|
| |
@patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"})
|
| |
@patch.dict("pagure.config.config", {"CHECK_SESSION_IP": False})
|
| |
def test_has_settings(self):
|
| |
@@ -1068,6 +1072,14 @@
|
| |
output.get_data(as_text=True),
|
| |
)
|
| |
|
| |
+ user = tests.FakeUser(username="foo")
|
| |
+ with tests.user_set(self.app.application, user):
|
| |
+ output = self.app.get("/logout/?next=%2f%2f%09%2fgoogle.fr")
|
| |
+ self.assertEqual(output.status_code, 302)
|
| |
+ self.assertTrue(
|
| |
+ output.headers["location"] in ("http://localhost/google.fr",)
|
| |
+ )
|
| |
+
|
| |
@patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"})
|
| |
def test_settings_admin_session_timedout(self):
|
| |
"""Test the admin_session_timedout with settings endpoint."""
|
| |
@@ -1085,7 +1097,14 @@
|
| |
# redirect again for the login page
|
| |
output = self.app.get("/settings/")
|
| |
self.assertEqual(output.status_code, 302)
|
| |
- self.assertIn("http://localhost/login/", output.location)
|
| |
+ self.assertTrue(
|
| |
+ output.location
|
| |
+ in (
|
| |
+ "http://localhost/login/",
|
| |
+ "/login/?next=http%3A%2F%2Flocalhost%2Fsettings%2F",
|
| |
+ "http://localhost/login/?next=http%3A%2F%2Flocalhost%2Fsettings%2F",
|
| |
+ )
|
| |
+ )
|
| |
# session did not expire
|
| |
user.login_time = datetime.datetime.utcnow() - lifetime + td1
|
| |
with tests.user_set(self.app.application, user):
|
| |
@@ -1127,14 +1146,17 @@
|
| |
data = {"csrf_token": self.get_csrf()}
|
| |
output = self.app.post("/settings/forcelogout/", data=data)
|
| |
self.assertEqual(output.status_code, 302)
|
| |
- self.assertEqual(
|
| |
- output.headers["Location"], "http://localhost/settings"
|
| |
+ self.assertTrue(
|
| |
+ output.headers["Location"]
|
| |
+ in ("http://localhost/settings", "/settings")
|
| |
)
|
| |
|
| |
# We should now get redirected to index, because our session became
|
| |
# invalid
|
| |
output = self.app.get("/settings")
|
| |
- self.assertEqual(output.headers["Location"], "http://localhost/")
|
| |
+ self.assertTrue(
|
| |
+ output.headers["Location"] in ("http://localhost/", "/")
|
| |
+ )
|
| |
|
| |
# After changing the login_time to now, the session should again be
|
| |
# valid
|
| |