Lists with ElementGetable capacity

This commit is contained in:
Vincent Jacques
2012-02-22 17:22:53 +01:00
parent 884503f29f
commit df2c351cc4
4 changed files with 34 additions and 6 deletions
+19 -1
View File
@@ -287,7 +287,7 @@ class GithubObjectWithModifiableListOfObjects( TestCaseWithGithubTestObject ):
"GithubTestObject",
BaseUrl( lambda obj: "/test" ),
BasicAttributes( "a1", "a2" ),
ListOfObjects( "a3s", ContainedObject, Creatable( "a3", [ "name" ], [ "p1", "p2" ] ) )
ListOfObjects( "a3s", ContainedObject, ElementCreatable( "a3", [ "name" ], [ "p1", "p2" ] ) )
)
def testCreate( self ):
@@ -332,6 +332,24 @@ class GithubObjectWithObjectGetter( TestCaseWithGithubTestObject ):
self.expectDataGet( "/test/a3s/idGet" ).andReturn( { "id": "idGet" } )
self.assertEqual( self.o.get_a3( "idGet" ).id, "idGet" )
class GithubObjectWithElementGetableList( TestCaseWithGithubTestObject ):
ContainedObject = GithubObject(
"ContainedObject",
BaseUrl( lambda obj: "/test/a3s/" + obj.id ),
BasicAttributes( "id", "name" )
)
GithubTestObject = GithubObject(
"GithubTestObject",
BaseUrl( lambda obj: "/test" ),
BasicAttributes( "a1", "a2" ),
ListOfObjects( "a3s", ContainedObject, ElementGetable( "a3" ) )
)
def testGetList( self ):
self.expectDataGet( "/test/a3s/idGet" ).andReturn( { "id": "idGet" } )
self.assertEqual( self.o.get_a3( "idGet" ).id, "idGet" )
def myCallable( obj, mock, arg ):
return mock.call( arg )