launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20780
[Merge] lp:~cjwatson/launchpad/github-bugtracker-names into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/github-bugtracker-names into lp:launchpad.
Commit message:
Select better automatic names for GitHub bugtrackers.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/github-bugtracker-names/+merge/299963
Select better automatic names for GitHub bugtrackers.
Without this, we get "auto-github.com", "auto-github.com-1", "auto-github.com-2" etc. in creation order, which works but is not very helpful.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/github-bugtracker-names into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bugtracker.py'
--- lib/lp/bugs/model/bugtracker.py 2016-07-04 17:11:29 +0000
+++ lib/lp/bugs/model/bugtracker.py 2016-07-13 15:27:48 +0000
@@ -148,6 +148,10 @@
else:
raise AssertionError(
'Not a valid email address: %s' % base_uri.path)
+ elif base_uri.host == 'github.com' and base_uri.path.endswith('/issues'):
+ base_name = (
+ 'github-' +
+ base_uri.path[:-len('/issues')].lstrip('/').replace('/', '-'))
else:
base_name = base_uri.host
=== modified file 'lib/lp/bugs/tests/test_bugtracker.py'
--- lib/lp/bugs/tests/test_bugtracker.py 2015-10-15 14:09:50 +0000
+++ lib/lp/bugs/tests/test_bugtracker.py 2016-07-13 15:27:48 +0000
@@ -396,31 +396,43 @@
"""Tests for make_bugtracker_name."""
def test_url(self):
- self.assertEquals(
+ self.assertEqual(
'auto-bugs.example.com',
make_bugtracker_name('http://bugs.example.com/shrubbery'))
def test_email_address(self):
- self.assertEquals(
+ self.assertEqual(
'auto-foo.bar',
make_bugtracker_name('mailto:foo.bar@xxxxxxxxxxxxx'))
def test_sanitises_forbidden_characters(self):
- self.assertEquals(
+ self.assertEqual(
'auto-foobar',
make_bugtracker_name('mailto:foo_bar@xxxxxxxxxxxxx'))
+ def test_github(self):
+ self.assertEqual(
+ 'auto-github-user-repository',
+ make_bugtracker_name('https://github.com/user/repository/issues'))
+ # Invalid on the GitHub side, but let's make sure these don't blow up.
+ self.assertEqual(
+ 'auto-github-user',
+ make_bugtracker_name('https://github.com/user/issues'))
+ self.assertEqual(
+ 'auto-github-user-foo-bar',
+ make_bugtracker_name('https://github.com/user/foo/bar/issues'))
+
class TestMakeBugtrackerTitle(TestCase):
"""Tests for make_bugtracker_title."""
def test_url(self):
- self.assertEquals(
+ self.assertEqual(
'bugs.example.com/shrubbery',
make_bugtracker_title('http://bugs.example.com/shrubbery'))
def test_email_address(self):
- self.assertEquals(
+ self.assertEqual(
'Email to foo.bar@somewhere',
make_bugtracker_title('mailto:foo.bar@xxxxxxxxxxxxx'))
Follow ups