From 00a832e6d519dac96142f650d6363f24459f9145 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Sat, 3 Mar 2012 12:44:54 +0000 Subject: [PATCH] Hook testing --- IntegrationTest.py | 3 +-- ReferenceOfClasses.md | 23 ++++++++++++++++++----- github/GithubObjects.py | 3 +++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/IntegrationTest.py b/IntegrationTest.py index 04896d0f..2e5c2edd 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -383,8 +383,7 @@ class IntegrationTest: sameHook = r.get_hook( h.id ) - ### @todo Uncomment when API `/repos/:user/:repo/hooks/:id/test` is implemented - # h.test() + h.test() h.delete() self.printList( "Hooks", r.get_hooks(), lambda h: h.name + str( h.config ) ) diff --git a/ReferenceOfClasses.md b/ReferenceOfClasses.md index 88be7b4a..8b0572dd 100644 --- a/ReferenceOfClasses.md +++ b/ReferenceOfClasses.md @@ -302,10 +302,10 @@ Attributes * `sha` * `url` * `message` +* `parents` * `author` * `committer` -* `tree` -* `parents` +* `tree`: `GitTree` Class `GitRef` ============== @@ -346,15 +346,28 @@ Class `Hook` Attributes ---------- +* `url` +* `updated_at` +* `created_at` +* `name` +* `events` +* `active` +* `config` +* `id` +* `last_response` Modification ------------ -* `edit()` +* `edit( name, config, [events, add_events, remove_events, active] )` Deletion -------- * `delete()` +Testing +------- +* `test()` + Class `Issue` ============= @@ -728,7 +741,7 @@ Hooks ----- * `get_hooks()`: list of `Hook` * `get_hook( id )`: `Hook` -* `create_hook()`: `Hook` +* `create_hook( name, config, [events, active] )`: `Hook` Keys ---- @@ -912,7 +925,7 @@ Attributes Modification ------------ -* `edit( title, key )` +* `edit( [title, key] )` Deletion -------- diff --git a/github/GithubObjects.py b/github/GithubObjects.py index f14e4158..b8217841 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -3,6 +3,8 @@ import urllib from GithubObject import * +def __testHook( hook ): + hook._github._statusRequest( "POST", hook._baseUrl + "/test", None, None ) Hook = GithubObject( "Hook", BaseUrl( lambda obj: obj._repo._baseUrl + "/hooks/" + str( obj.id ) ), @@ -13,6 +15,7 @@ Hook = GithubObject( ), Editable( [ "name", "config" ], [ "events", "add_events", "remove_events", "active" ] ), Deletable(), + SeveralAttributePolicies( [ MethodFromCallable( "test", [], [], __testHook, SimpleTypePolicy( None ) ) ], "Testing" ) ) Authorization = GithubObject(