From 48d84d7d2316c51f1d2d732351e41f1ea6f69c1f Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Wed, 22 Feb 2012 20:19:10 +0000 Subject: [PATCH] Refactor unit-tests --- github/GithubObject.UnitTest.py | 4 ++-- github/GithubObject.py | 2 +- github/ObjectCapacities/List.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/github/GithubObject.UnitTest.py b/github/GithubObject.UnitTest.py index b6a54b02..3d1c63cc 100644 --- a/github/GithubObject.UnitTest.py +++ b/github/GithubObject.UnitTest.py @@ -205,7 +205,7 @@ class GithubObjectWithListOfReferences( TestCaseWithGithubTestObject ): "GithubTestObject", BaseUrl( lambda obj: "/test" ), BasicAttributes( "a1", "a2" ), - ListOfReferences( "a3s", ContainedObject, getParameters = [ "type" ] ) + ListOfObjects( "a3s", ContainedObject, ListGetable( [], [ "type" ] ) ) ) def testGetList( self ): @@ -255,7 +255,7 @@ class GithubObjectWithModifiableListOfReferences( TestCaseWithGithubTestObject ) "GithubTestObject", BaseUrl( lambda obj: "/test" ), BasicAttributes( "a1", "a2" ), - ListOfReferences( "a3s", ContainedObject, addable = True, removable = True, hasable = True ) + ListOfObjects( "a3s", ContainedObject, ListGetable( [], [] ), ElementAddable(), ElementRemovable(), ElementHasable() ) ) def testAddToList( self ): diff --git a/github/GithubObject.py b/github/GithubObject.py index 4ddd9ee1..c7dbb2cf 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -2,7 +2,7 @@ import itertools import ObjectCapacities.ArgumentsChecker as ArgumentsChecker from ObjectCapacities.Basic import AttributeFromCallable, MethodFromCallable -from ObjectCapacities.List import ListOfObjects, ListOfReferences, ListGetable, ElementCreatable, ElementGetable +from ObjectCapacities.List import ListOfObjects, ListOfReferences, ListGetable, ElementCreatable, ElementGetable, ElementAddable, ElementRemovable, ElementHasable class BadGithubObjectException( Exception ): pass diff --git a/github/ObjectCapacities/List.py b/github/ObjectCapacities/List.py index 086df726..238995e0 100644 --- a/github/ObjectCapacities/List.py +++ b/github/ObjectCapacities/List.py @@ -12,7 +12,7 @@ class ElementAddable: assert isinstance( toBeAdded, self.__type ) obj._github._statusRequest( "PUT", obj._baseUrl + "/" + self.__attributeName + "/" + toBeAdded._identity, None, None ) -class ElementRemoveable: +class ElementRemovable: def apply( self, list, cls ): self.__type = list.type self.__attributeName = list.attributeName @@ -93,7 +93,7 @@ class ListOfReferences( ListOfObjects ): if addable: capacities.append( ElementAddable() ) if removable: - capacities.append( ElementRemoveable() ) + capacities.append( ElementRemovable() ) if hasable: capacities.append( ElementHasable() ) ListOfObjects.__init__( self, attributeName, type, *capacities )