Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit83337c9

Browse files
committed
sigmavirus24gh-543 Update regex to include hyphens in username
Fix bug where a username which contains a hyphen cannot be used in the `GitHub.pubsubhubbub` method.
1 parent5c85bd1 commit83337c9

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

‎github3/github.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,8 @@ def pubsubhubbub(self, mode, topic, callback, secret=''):
998998
:returns: bool
999999
"""
10001000
fromreimportmatch
1001-
m=match('https?://[\w\d\-\.\:]+/\w+/[\w\._-]+/events/\w+',topic)
1001+
m=match('https?://[\w\d\-\.\:]+/\w[\w-]+\w/[\w\._-]+/events/\w+',
1002+
topic)
10021003
status=False
10031004
ifmodeandtopicandcallbackandm:
10041005
data= [('hub.mode',mode), ('hub.topic',topic),

‎tests/unit/test_github.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,32 @@ def test_pubsubhubbub(self):
416416
}
417417
)
418418

419+
deftest_pubsubhubbub_invalid_username(self):
420+
"""Verify a valid call with invalid username does not call post."""
421+
topic= (
422+
'hub.topic',
423+
'https://github.com/-octocat/hello-world/events/push'
424+
)
425+
body= [('hub.mode','subscribe'),
426+
topic,
427+
('hub.callback','https://localhost/post')]
428+
data=dict([(k[4:],v)fork,vinbody])
429+
self.instance.pubsubhubbub(**data)
430+
assertself.session.post.calledisFalse
431+
432+
deftest_pubsubhubbub_valid_username(self):
433+
"""Verify a valid call with valid username calls post."""
434+
topic= (
435+
'hub.topic',
436+
'https://github.com/o-cto-ca-t/hello-world/events/push'
437+
)
438+
body= [('hub.mode','subscribe'),
439+
topic,
440+
('hub.callback','https://localhost/post')]
441+
data=dict([(k[4:],v)fork,vinbody])
442+
self.instance.pubsubhubbub(**data)
443+
assertself.session.post.calledisTrue
444+
419445
deftest_pubsubhubbub_secret(self):
420446
"""Verify the request for creating a pubsubhubbub hook."""
421447
topic= (

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp