Skip to content

Commit a08b5ad

Browse files
committed
Fixed a couple of failing tests for *LoginRedirect in test_actions.py after url validation. Also raise ValueError from examine_url if base url is None.
1 parent 40f921d commit a08b5ad

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

roundup/cgi/actions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ def examine_url(self, url):
8282
'''
8383

8484
parsed_url_tuple = urllib_.urlparse(url)
85-
parsed_base_url_tuple = urllib_.urlparse(self.base)
85+
if self.base:
86+
parsed_base_url_tuple = urllib_.urlparse(self.base)
87+
else:
88+
raise ValueError(self._("Base url not set. Check configuration."))
8689

8790
info={ 'url': url,
8891
'base_url': self.base,

test/test_actions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def setUp(self):
2323
self.client.add_ok_message = lambda x : add_message(
2424
self.client._ok_message, x)
2525
self.client.form = self.form
26+
self.client.base = "http://whoami.com/path/"
2627
class TemplatingUtils:
2728
pass
2829
self.client.instance.interfaces.TemplatingUtils = TemplatingUtils
@@ -323,8 +324,8 @@ def opendb(username):
323324

324325
# test if we are logged out; should kill the @action=logout
325326
self.form.value[:] = [] # clear out last test's setup values
326-
self.assertLoginRaisesRedirect("http://localhost:9017/demo/issue39?%40startwith=0&%40pagesize=50",
327-
'foo', 'right', "http://localhost:9017/demo/issue39?@action=logout&@pagesize=50&@startwith=0")
327+
self.assertLoginRaisesRedirect("http://whoami.com/path/issue39?%40startwith=0&%40pagesize=50",
328+
'foo', 'right', "http://whoami.com/path/issue39?@action=logout&@pagesize=50&@startwith=0")
328329

329330
def testInvalidLoginRedirect(self):
330331
self.client.db.security.hasPermission = lambda *args, **kwargs: True

0 commit comments

Comments
 (0)