Improve test coverage of NamedUser

This commit is contained in:
Vincent Jacques
2012-05-20 13:35:11 +01:00
parent beaa58ca0c
commit 6a2e4b4958
17 changed files with 229 additions and 31 deletions
-29
View File
@@ -12,68 +12,53 @@ class Event( object ):
self.__requester = requester
self.__initAttributes()
self.__useAttributes( attributes )
self.__completed = completion != LazyCompletion
if completion == ImmediateCompletion:
self.__complete()
@property
def actor( self ):
self.__completeIfNeeded( self.__actor )
return self.__actor
@property
def commit_id( self ):
self.__completeIfNeeded( self.__commit_id )
return self.__commit_id
@property
def created_at( self ):
self.__completeIfNeeded( self.__created_at )
return self.__created_at
@property
def event( self ):
self.__completeIfNeeded( self.__event )
return self.__event
@property
def id( self ):
self.__completeIfNeeded( self.__id )
return self.__id
@property
def issue( self ):
self.__completeIfNeeded( self.__issue )
return self.__issue
@property
def org( self ):
self.__completeIfNeeded( self.__org )
return self.__org
@property
def payload( self ):
self.__completeIfNeeded( self.__payload )
return self.__payload
@property
def public( self ):
self.__completeIfNeeded( self.__public )
return self.__public
@property
def repo( self ):
self.__completeIfNeeded( self.__repo )
return self.__repo
@property
def type( self ):
self.__completeIfNeeded( self.__type )
return self.__type
@property
def url( self ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
@@ -90,20 +75,6 @@ class Event( object ):
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
def __complete( self ):
status, headers, data = self.__requester.request(
"GET",
self.__url,
None,
None
)
self.__useAttributes( data )
self.__completed = True
def __useAttributes( self, attributes ):
# @todo Remove this debug weakness: we shall assume that github will add new attributes
for attribute in attributes: