Test Branch and Commit attributes

This commit is contained in:
Vincent Jacques
2012-05-10 19:16:36 +02:00
parent a78d82212b
commit efa58887aa
10 changed files with 366 additions and 19 deletions
+15 -3
View File
@@ -2,8 +2,11 @@
# Do not modify it manually, your work would be lost.
import PaginatedList
import CommitFile
import NamedUser
import GitCommit
import CommitStats
import Commit
import CommitComment
# This allows None as a valid value for an optional parameter
@@ -130,14 +133,23 @@ class Commit( object ):
assert isinstance( attributes[ "committer" ], dict )
self.__committer = NamedUser.NamedUser( self.__requester, attributes[ "committer" ], lazy = True )
if "files" in attributes and attributes[ "files" ] is not None:
self.__files = attributes[ "files" ]
assert isinstance( attributes[ "files" ], list ) and ( len( attributes[ "files" ] ) == 0 or isinstance( attributes[ "files" ][ 0 ], dict ) )
self.__files = [
CommitFile.CommitFile( self.__requester, element, lazy = True )
for element in attributes[ "files" ]
]
if "parents" in attributes and attributes[ "parents" ] is not None:
self.__parents = attributes[ "parents" ]
assert isinstance( attributes[ "parents" ], list ) and ( len( attributes[ "parents" ] ) == 0 or isinstance( attributes[ "parents" ][ 0 ], dict ) )
self.__parents = [
Commit( self.__requester, element, lazy = True )
for element in attributes[ "parents" ]
]
if "sha" in attributes and attributes[ "sha" ] is not None:
assert isinstance( attributes[ "sha" ], ( str, unicode ) )
self.__sha = attributes[ "sha" ]
if "stats" in attributes and attributes[ "stats" ] is not None:
self.__stats = attributes[ "stats" ]
assert isinstance( attributes[ "stats" ], dict )
self.__stats = CommitStats.CommitStats( self.__requester, attributes[ "stats" ], lazy = True )
if "url" in attributes and attributes[ "url" ] is not None:
assert isinstance( attributes[ "url" ], ( str, unicode ) )
self.__url = attributes[ "url" ]
+84
View File
@@ -0,0 +1,84 @@
# WARNING: this file is generated automaticaly.
# Do not modify it manually, your work would be lost.
import PaginatedList
# This allows None as a valid value for an optional parameter
class DefaultValueForOptionalParametersType:
pass
DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType()
class CommitFile( object ):
def __init__( self, requester, attributes, lazy ):
self.__requester = requester
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
@property
def additions( self ):
return self.__additions
@property
def blob_url( self ):
return self.__blob_url
@property
def changes( self ):
return self.__changes
@property
def deletions( self ):
return self.__deletions
@property
def filename( self ):
return self.__filename
@property
def patch( self ):
return self.__patch
@property
def raw_url( self ):
return self.__raw_url
@property
def sha( self ):
return self.__sha
@property
def status( self ):
return self.__status
def __initAttributes( self ):
self.__additions = None
self.__blob_url = None
self.__changes = None
self.__deletions = None
self.__filename = None
self.__patch = None
self.__raw_url = None
self.__sha = None
self.__status = None
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "additions" in attributes and attributes[ "additions" ] is not None:
self.__additions = attributes[ "additions" ]
if "blob_url" in attributes and attributes[ "blob_url" ] is not None:
self.__blob_url = attributes[ "blob_url" ]
if "changes" in attributes and attributes[ "changes" ] is not None:
self.__changes = attributes[ "changes" ]
if "deletions" in attributes and attributes[ "deletions" ] is not None:
self.__deletions = attributes[ "deletions" ]
if "filename" in attributes and attributes[ "filename" ] is not None:
self.__filename = attributes[ "filename" ]
if "patch" in attributes and attributes[ "patch" ] is not None:
self.__patch = attributes[ "patch" ]
if "raw_url" in attributes and attributes[ "raw_url" ] is not None:
self.__raw_url = attributes[ "raw_url" ]
if "sha" in attributes and attributes[ "sha" ] is not None:
self.__sha = attributes[ "sha" ]
if "status" in attributes and attributes[ "status" ] is not None:
self.__status = attributes[ "status" ]
+45
View File
@@ -0,0 +1,45 @@
# WARNING: this file is generated automaticaly.
# Do not modify it manually, your work would be lost.
import PaginatedList
# This allows None as a valid value for an optional parameter
class DefaultValueForOptionalParametersType:
pass
DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType()
class CommitStats( object ):
def __init__( self, requester, attributes, lazy ):
self.__requester = requester
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
@property
def additions( self ):
return self.__additions
@property
def deletions( self ):
return self.__deletions
@property
def total( self ):
return self.__total
def __initAttributes( self ):
self.__additions = None
self.__deletions = None
self.__total = None
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "additions" in attributes and attributes[ "additions" ] is not None:
assert isinstance( attributes[ "additions" ], int )
self.__additions = attributes[ "additions" ]
if "deletions" in attributes and attributes[ "deletions" ] is not None:
assert isinstance( attributes[ "deletions" ], int )
self.__deletions = attributes[ "deletions" ]
if "total" in attributes and attributes[ "total" ] is not None:
assert isinstance( attributes[ "total" ], int )
self.__total = attributes[ "total" ]