Repository: khornberg/octokit.py

Issue:
Verify seems broken(ish)
We've got a test that revealed an issue with this line of code:

https://github.com/khornberg/octokit.py/blob/master/src/octokit/webhook.py#L24

Since `webhook_names` contains a `*` this method will always return `True`

Discussion:

Patch:
diff --git a/setup.py b/setup.py
index 668640c..716e3e4 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ def read(*names, **kwargs):
 
 setup(
     name="octokitpy",
-    version="0.14.2",
+    version="0.14.3",
     license="MIT license",
     description="Python client for GitHub API",
     long_description="%s\n%s"
diff --git a/src/octokit/webhook.py b/src/octokit/webhook.py
index f3c070a..2679c39 100644
--- a/src/octokit/webhook.py
+++ b/src/octokit/webhook.py
@@ -21,7 +21,7 @@ def valid_guid(guid):
 
 
 def valid_event(event, events):
-    return event in webhook_names or "*" in webhook_names
+    return event in webhook_names
 
 
 def valid_user_agent(ua):


Test patch:
diff --git a/tests/test_webhook.py b/tests/test_webhook.py
index e515b6c..9c58917 100644
--- a/tests/test_webhook.py
+++ b/tests/test_webhook.py
@@ -116,3 +116,14 @@ class TestWebhook(object):
         payload = ""
         secret = "secret"
         assert webhook.verify(headers, payload, secret, events=["*"], return_app_id=True)
+
+    def test_must_have_a_valid_event(self):
+        headers = {
+            "X-Hub-Signature": "sha1=25af6174a0fcecc4d346680a72b7ce644b9a88e8",
+            "X-GitHub-Event": "blah",
+            "X-GitHub-Delivery": "72d3162f-cc78-11e3-81ab-4c9367dc0958",
+        }
+        payload = ""
+        secret = "secret"
+        events = ["push"]
+        assert webhook.verify(headers, payload, secret, events=events) is False