Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Failing test for case clobbering of Team URLs #3719

Merged
merged 3 commits into from
Aug 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/py/test_teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ def test_all_fields_persist(self):
assert team.onboarding_url == 'http://inside.gratipay.com/'
assert team.todo_url == 'https://github.com/gratipay'

def test_casing_of_urls_survives(self):
self.make_participant('alice', claimed_time='now', email_address='', last_paypal_result='')
self.post_new(dict( self.valid_data
, homepage='Http://gratipay.com/'
, onboarding_url='http://INSIDE.GRATipay.com/'
, todo_url='hTTPS://github.com/GRATIPAY'
))
team = Team.from_slug('gratiteam')
assert team.homepage == 'Http://gratipay.com/'
assert team.onboarding_url == 'http://INSIDE.GRATipay.com/'
assert team.todo_url == 'hTTPS://github.com/GRATIPAY'

def test_401_for_anon_creating_new_team(self):
self.post_new(self.valid_data, auth_as=None, expected=401)
assert self.db.one("SELECT COUNT(*) FROM teams") == 0
Expand Down
4 changes: 2 additions & 2 deletions www/teams/create.json.spt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ if request.method == 'POST':
fields[field] = value

for field in ('homepage', 'onboarding_url', 'todo_url'):
fields[field] = fields[field].lower()
if not any(map(fields[field].startswith, ('http://', 'https://'))):
fields[field] = fields[field]
if not any(map(fields[field].lower().startswith, ('http://', 'https://'))):
raise Response(400, _( "Please enter an http[s]:// URL for the '{}' field."
, field_names[field]
))
Expand Down