Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix edit tracker url to require > 0 digits. Added test for this.

  • Loading branch information...
commit b702f32db3c8a2afdd7998193c111ab83fbe1f7c 1 parent 542d50a
@berryp berryp authored
Showing with 16 additions and 1 deletion.
  1. +15 −0 mysite/customs/tests.py
  2. +1 −1  mysite/urls.py
View
15 mysite/customs/tests.py
@@ -2148,6 +2148,21 @@ def test_bug_tracker_edit_form_fills_in_hidden_field(self):
self.assertEqual(self.twisted,
response.context['tracker_form'].initial['created_for_project'])
+ def test_bug_tracker_edit_url_missing_url_id_404s(self):
+ client = self.login_with_client()
+ url = reverse(mysite.customs.views.edit_tracker_url, kwargs={
+ 'tracker_type': 'trac', 'tracker_name': 'whatever',
+ 'url_id': '000'})
+
+ # reverse won't work without a url_id so we need to add one
+ # then remove it once the url has been generated.
+ url = url.replace('000', '')
+
+ response = client.get(url)
+ print response.status_code
+
+ assert response.status_code == 404
+
@skipIf(mysite.base.depends.lxml.html is None, "To run these tests, you must install lxml. See ADVANCED_INSTALLATION.mkd for more.")
class BugzillaTrackerEditingViews(TwillTests):
fixtures = ['user-paulproteus', 'person-paulproteus']
View
2  mysite/urls.py
@@ -161,7 +161,7 @@
(r'^customs/add/(?P<tracker_type>\w*)/(?P<tracker_name>[^/]+)/url/do$', 'mysite.customs.views.add_tracker_url_do'),
(r'^customs/edit/(?P<tracker_type>\w*)/(?P<tracker_name>[^/]+)$', 'mysite.customs.views.edit_tracker'),
(r'^customs/edit/(?P<tracker_type>\w*)/(?P<tracker_name>[^/]+)/do$', 'mysite.customs.views.edit_tracker_do'),
- (r'^customs/edit/(?P<tracker_type>\w*)/(?P<tracker_name>[^/]+)/url/(?P<url_id>\d*)$', 'mysite.customs.views.edit_tracker_url'),
+ (r'^customs/edit/(?P<tracker_type>\w*)/(?P<tracker_name>[^/]+)/url/(?P<url_id>\d+)$', 'mysite.customs.views.edit_tracker_url'),
(r'^customs/edit/(?P<tracker_type>\w*)/(?P<tracker_name>[^/]+)/url/(?P<url_id>\d*)/do$', 'mysite.customs.views.edit_tracker_url_do'),
(r'^customs/delete/(?P<tracker_type>\w*)/(?P<tracker_name>[^/]+)$', 'mysite.customs.views.delete_tracker'),
(r'^customs/delete/(?P<tracker_type>\w*)/(?P<tracker_name>[^/]+)/do$', 'mysite.customs.views.delete_tracker_do'),
Please sign in to comment.
Something went wrong with that request. Please try again.