Test Organization attributes

This commit is contained in:
Vincent Jacques
2012-05-12 11:15:20 +02:00
parent 93007180f6
commit 5a943ad0b2
8 changed files with 176 additions and 65 deletions
+23 -1
View File
@@ -3,6 +3,7 @@
import PaginatedList
import Team
import Plan
import Event
import Repository
import NamedUser
@@ -382,30 +383,43 @@ class Organization( object ):
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "avatar_url" in attributes and attributes[ "avatar_url" ] is not None:
assert isinstance( attributes[ "avatar_url" ], ( str, unicode ) )
self.__avatar_url = attributes[ "avatar_url" ]
if "billing_email" in attributes and attributes[ "billing_email" ] is not None:
assert isinstance( attributes[ "billing_email" ], ( str, unicode ) )
self.__billing_email = attributes[ "billing_email" ]
if "blog" in attributes and attributes[ "blog" ] is not None:
assert isinstance( attributes[ "blog" ], ( str, unicode ) )
self.__blog = attributes[ "blog" ]
if "collaborators" in attributes and attributes[ "collaborators" ] is not None:
assert isinstance( attributes[ "collaborators" ], int )
self.__collaborators = attributes[ "collaborators" ]
if "company" in attributes and attributes[ "company" ] is not None:
assert isinstance( attributes[ "company" ], ( str, unicode ) )
self.__company = attributes[ "company" ]
if "created_at" in attributes and attributes[ "created_at" ] is not None:
assert isinstance( attributes[ "created_at" ], ( str, unicode ) )
self.__created_at = attributes[ "created_at" ]
if "disk_usage" in attributes and attributes[ "disk_usage" ] is not None:
assert isinstance( attributes[ "disk_usage" ], int )
self.__disk_usage = attributes[ "disk_usage" ]
if "email" in attributes and attributes[ "email" ] is not None:
assert isinstance( attributes[ "email" ], ( str, unicode ) )
self.__email = attributes[ "email" ]
if "followers" in attributes and attributes[ "followers" ] is not None:
assert isinstance( attributes[ "followers" ], int )
self.__followers = attributes[ "followers" ]
if "following" in attributes and attributes[ "following" ] is not None:
assert isinstance( attributes[ "following" ], int )
self.__following = attributes[ "following" ]
if "gravatar_id" in attributes and attributes[ "gravatar_id" ] is not None:
assert isinstance( attributes[ "gravatar_id" ], ( str, unicode ) )
self.__gravatar_id = attributes[ "gravatar_id" ]
if "html_url" in attributes and attributes[ "html_url" ] is not None:
assert isinstance( attributes[ "html_url" ], ( str, unicode ) )
self.__html_url = attributes[ "html_url" ]
if "id" in attributes and attributes[ "id" ] is not None:
assert isinstance( attributes[ "id" ], int )
self.__id = attributes[ "id" ]
if "location" in attributes and attributes[ "location" ] is not None:
assert isinstance( attributes[ "location" ], ( str, unicode ) )
@@ -417,18 +431,26 @@ class Organization( object ):
assert isinstance( attributes[ "name" ], ( str, unicode ) )
self.__name = attributes[ "name" ]
if "owned_private_repos" in attributes and attributes[ "owned_private_repos" ] is not None:
assert isinstance( attributes[ "owned_private_repos" ], int )
self.__owned_private_repos = attributes[ "owned_private_repos" ]
if "plan" in attributes and attributes[ "plan" ] is not None:
self.__plan = attributes[ "plan" ]
assert isinstance( attributes[ "plan" ], dict )
self.__plan = Plan.Plan( self.__requester, attributes[ "plan" ], lazy = True )
if "private_gists" in attributes and attributes[ "private_gists" ] is not None:
assert isinstance( attributes[ "private_gists" ], int )
self.__private_gists = attributes[ "private_gists" ]
if "public_gists" in attributes and attributes[ "public_gists" ] is not None:
assert isinstance( attributes[ "public_gists" ], int )
self.__public_gists = attributes[ "public_gists" ]
if "public_repos" in attributes and attributes[ "public_repos" ] is not None:
assert isinstance( attributes[ "public_repos" ], int )
self.__public_repos = attributes[ "public_repos" ]
if "total_private_repos" in attributes and attributes[ "total_private_repos" ] is not None:
assert isinstance( attributes[ "total_private_repos" ], int )
self.__total_private_repos = attributes[ "total_private_repos" ]
if "type" in attributes and attributes[ "type" ] is not None:
assert isinstance( attributes[ "type" ], ( str, unicode ) )
self.__type = attributes[ "type" ]
if "url" in attributes and attributes[ "url" ] is not None:
assert isinstance( attributes[ "url" ], ( str, unicode ) )
self.__url = attributes[ "url" ]