Fix attributes of complex type => fix testNamedUserDetails!

This commit is contained in:
Vincent Jacques
2012-05-03 22:37:22 +01:00
parent d64c1e89a5
commit ca863533b5
31 changed files with 59 additions and 23 deletions
@@ -404,6 +404,7 @@ class AuthenticatedUser( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "avatar_url" in attributes:
self.__avatar_url = attributes[ "avatar_url" ]
if "bio" in attributes:
+1
View File
@@ -107,6 +107,7 @@ class Authorization( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "app" in attributes:
self.__app = attributes[ "app" ]
if "created_at" in attributes:
+2 -1
View File
@@ -42,7 +42,8 @@ class Branch( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "commit" in attributes:
self.__commit = attributes[ "commit" ]
self.__commit = Commit.Commit( self.__github, attributes[ "commit" ], lazy = True )
if "name" in attributes:
self.__name = attributes[ "name" ]
+4 -3
View File
@@ -95,12 +95,13 @@ class Commit( object ):
]
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "author" in attributes:
self.__author = attributes[ "author" ]
self.__author = NamedUser.NamedUser( self.__github, attributes[ "author" ], lazy = True )
if "commit" in attributes:
self.__commit = attributes[ "commit" ]
self.__commit = GitCommit.GitCommit( self.__github, attributes[ "commit" ], lazy = True )
if "committer" in attributes:
self.__committer = attributes[ "committer" ]
self.__committer = NamedUser.NamedUser( self.__github, attributes[ "committer" ], lazy = True )
if "files" in attributes:
self.__files = attributes[ "files" ]
if "parents" in attributes:
+2 -1
View File
@@ -111,6 +111,7 @@ class CommitComment( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "body" in attributes:
self.__body = attributes[ "body" ]
if "commit_id" in attributes:
@@ -132,4 +133,4 @@ class CommitComment( object ):
if "url" in attributes:
self.__url = attributes[ "url" ]
if "user" in attributes:
self.__user = attributes[ "user" ]
self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True )
+1
View File
@@ -152,6 +152,7 @@ class Download( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "accesskeyid" in attributes:
self.__accesskeyid = attributes[ "accesskeyid" ]
if "acl" in attributes:
+4 -3
View File
@@ -104,8 +104,9 @@ class Event( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "actor" in attributes:
self.__actor = attributes[ "actor" ]
self.__actor = NamedUser.NamedUser( self.__github, attributes[ "actor" ], lazy = True )
if "commit_id" in attributes:
self.__commit_id = attributes[ "commit_id" ]
if "created_at" in attributes:
@@ -117,13 +118,13 @@ class Event( object ):
if "issue" in attributes:
self.__issue = attributes[ "issue" ]
if "org" in attributes:
self.__org = attributes[ "org" ]
self.__org = Organization.Organization( self.__github, attributes[ "org" ], lazy = True )
if "payload" in attributes:
self.__payload = attributes[ "payload" ]
if "public" in attributes:
self.__public = attributes[ "public" ]
if "repo" in attributes:
self.__repo = attributes[ "repo" ]
self.__repo = Repository.Repository( self.__github, attributes[ "repo" ], lazy = True )
if "type" in attributes:
self.__type = attributes[ "type" ]
if "url" in attributes:
+2 -1
View File
@@ -164,6 +164,7 @@ class Gist( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "comments" in attributes:
self.__comments = attributes[ "comments" ]
if "created_at" in attributes:
@@ -191,4 +192,4 @@ class Gist( object ):
if "url" in attributes:
self.__url = attributes[ "url" ]
if "user" in attributes:
self.__user = attributes[ "user" ]
self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True )
+2 -1
View File
@@ -81,6 +81,7 @@ class GistComment( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "body" in attributes:
self.__body = attributes[ "body" ]
if "created_at" in attributes:
@@ -92,4 +93,4 @@ class GistComment( object ):
if "url" in attributes:
self.__url = attributes[ "url" ]
if "user" in attributes:
self.__user = attributes[ "user" ]
self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True )
+1
View File
@@ -59,6 +59,7 @@ class GitBlob( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "content" in attributes:
self.__content = attributes[ "content" ]
if "encoding" in attributes:
+2 -1
View File
@@ -72,6 +72,7 @@ class GitCommit( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "author" in attributes:
self.__author = attributes[ "author" ]
if "committer" in attributes:
@@ -83,6 +84,6 @@ class GitCommit( object ):
if "sha" in attributes:
self.__sha = attributes[ "sha" ]
if "tree" in attributes:
self.__tree = attributes[ "tree" ]
self.__tree = GitTree.GitTree( self.__github, attributes[ "tree" ], lazy = True )
if "url" in attributes:
self.__url = attributes[ "url" ]
+1
View File
@@ -64,6 +64,7 @@ class GitRef( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "object" in attributes:
self.__object = attributes[ "object" ]
if "ref" in attributes:
+1
View File
@@ -65,6 +65,7 @@ class GitTag( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "message" in attributes:
self.__message = attributes[ "message" ]
if "object" in attributes:
+1
View File
@@ -53,6 +53,7 @@ class GitTree( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "recursive" in attributes:
self.__recursive = attributes[ "recursive" ]
if "sha" in attributes:
+1
View File
@@ -110,6 +110,7 @@ class Hook( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "active" in attributes:
self.__active = attributes[ "active" ]
if "config" in attributes:
+4 -3
View File
@@ -213,8 +213,9 @@ class Issue( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "assignee" in attributes:
self.__assignee = attributes[ "assignee" ]
self.__assignee = NamedUser.NamedUser( self.__github, attributes[ "assignee" ], lazy = True )
if "body" in attributes:
self.__body = attributes[ "body" ]
if "closed_at" in attributes:
@@ -232,7 +233,7 @@ class Issue( object ):
if "labels" in attributes:
self.__labels = attributes[ "labels" ]
if "milestone" in attributes:
self.__milestone = attributes[ "milestone" ]
self.__milestone = Milestone.Milestone( self.__github, attributes[ "milestone" ], lazy = True )
if "number" in attributes:
self.__number = attributes[ "number" ]
if "pull_request" in attributes:
@@ -246,4 +247,4 @@ class Issue( object ):
if "url" in attributes:
self.__url = attributes[ "url" ]
if "user" in attributes:
self.__user = attributes[ "user" ]
self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True )
+2 -1
View File
@@ -81,6 +81,7 @@ class IssueComment( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "body" in attributes:
self.__body = attributes[ "body" ]
if "created_at" in attributes:
@@ -92,4 +93,4 @@ class IssueComment( object ):
if "url" in attributes:
self.__url = attributes[ "url" ]
if "user" in attributes:
self.__user = attributes[ "user" ]
self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True )
+2 -1
View File
@@ -72,8 +72,9 @@ class IssueEvent( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "actor" in attributes:
self.__actor = attributes[ "actor" ]
self.__actor = NamedUser.NamedUser( self.__github, attributes[ "actor" ], lazy = True )
if "commit_id" in attributes:
self.__commit_id = attributes[ "commit_id" ]
if "created_at" in attributes:
+1
View File
@@ -63,6 +63,7 @@ class Label( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "color" in attributes:
self.__color = attributes[ "color" ]
if "name" in attributes:
+2 -1
View File
@@ -124,12 +124,13 @@ class Milestone( object ):
]
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "closed_issues" in attributes:
self.__closed_issues = attributes[ "closed_issues" ]
if "created_at" in attributes:
self.__created_at = attributes[ "created_at" ]
if "creator" in attributes:
self.__creator = attributes[ "creator" ]
self.__creator = NamedUser.NamedUser( self.__github, attributes[ "creator" ], lazy = True )
if "description" in attributes:
self.__description = attributes[ "description" ]
if "due_on" in attributes:
+1
View File
@@ -289,6 +289,7 @@ class NamedUser( object ):
]
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "avatar_url" in attributes:
self.__avatar_url = attributes[ "avatar_url" ]
if "bio" in attributes:
+1
View File
@@ -287,6 +287,7 @@ class Organization( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "avatar_url" in attributes:
self.__avatar_url = attributes[ "avatar_url" ]
if "billing_email" in attributes:
+2 -1
View File
@@ -251,6 +251,7 @@ class PullRequest( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "additions" in attributes:
self.__additions = attributes[ "additions" ]
if "base" in attributes:
@@ -302,4 +303,4 @@ class PullRequest( object ):
if "url" in attributes:
self.__url = attributes[ "url" ]
if "user" in attributes:
self.__user = attributes[ "user" ]
self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True )
+2 -1
View File
@@ -111,6 +111,7 @@ class PullRequestComment( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "body" in attributes:
self.__body = attributes[ "body" ]
if "commit_id" in attributes:
@@ -132,4 +133,4 @@ class PullRequestComment( object ):
if "url" in attributes:
self.__url = attributes[ "url" ]
if "user" in attributes:
self.__user = attributes[ "user" ]
self.__user = NamedUser.NamedUser( self.__github, attributes[ "user" ], lazy = True )
+1
View File
@@ -83,6 +83,7 @@ class PullRequestFile( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "additions" in attributes:
self.__additions = attributes[ "additions" ]
if "blob_url" in attributes:
+4 -3
View File
@@ -578,6 +578,7 @@ class Repository( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "clone_url" in attributes:
self.__clone_url = attributes[ "clone_url" ]
if "created_at" in attributes:
@@ -615,9 +616,9 @@ class Repository( object ):
if "organization" in attributes:
self.__organization = attributes[ "organization" ]
if "owner" in attributes:
self.__owner = attributes[ "owner" ]
self.__owner = NamedUser.NamedUser( self.__github, attributes[ "owner" ], lazy = True )
if "parent" in attributes:
self.__parent = attributes[ "parent" ]
self.__parent = Repository( self.__github, attributes[ "parent" ], lazy = True )
if "permissions" in attributes:
self.__permissions = attributes[ "permissions" ]
if "private" in attributes:
@@ -627,7 +628,7 @@ class Repository( object ):
if "size" in attributes:
self.__size = attributes[ "size" ]
if "source" in attributes:
self.__source = attributes[ "source" ]
self.__source = Repository( self.__github, attributes[ "source" ], lazy = True )
if "ssh_url" in attributes:
self.__ssh_url = attributes[ "ssh_url" ]
if "svn_url" in attributes:
+1
View File
@@ -69,6 +69,7 @@ class RepositoryKey( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "id" in attributes:
self.__id = attributes[ "id" ]
if "key" in attributes:
+2 -1
View File
@@ -54,8 +54,9 @@ class Tag( object ):
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "commit" in attributes:
self.__commit = attributes[ "commit" ]
self.__commit = Commit.Commit( self.__github, attributes[ "commit" ], lazy = True )
if "name" in attributes:
self.__name = attributes[ "name" ]
if "tarball_url" in attributes:
+1
View File
@@ -126,6 +126,7 @@ class Team( object ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "id" in attributes:
self.__id = attributes[ "id" ]
if "members_count" in attributes:
+1
View File
@@ -71,6 +71,7 @@ class UserKey( object ):
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "id" in attributes:
self.__id = attributes[ "id" ]
if "key" in attributes: