Implement has_in_ for extended list attributes

This commit is contained in:
Vincent Jacques
2012-02-14 08:12:15 +01:00
parent fe8652f64f
commit b28f5ee974
2 changed files with 40 additions and 2 deletions
+11 -1
View File
@@ -28,6 +28,9 @@ class TestCaseWithGithubTestObject( unittest.TestCase ):
def expectStatusPut( self, url ):
return self.g.expect._statusRequest( "PUT", url )
def expectStatusGet( self, url ):
return self.g.expect._statusRequest( "GET", url )
def expectDataPatch( self, url, data ):
return self.g.expect._dataRequest( "PATCH", url, data )
@@ -214,7 +217,7 @@ class GithubObjectWithModifiableExtendedListAttribute( TestCaseWithGithubTestObj
"GithubTestObject",
BaseUrl( lambda obj: "/test" ),
SimpleScalarAttributes( "a1", "a2" ),
ExtendedListAttribute( "a3s", ContainedObject, addable = True, removable = True )
ExtendedListAttribute( "a3s", ContainedObject, addable = True, removable = True, hasable = True )
)
def testAddToList( self ):
@@ -227,4 +230,11 @@ class GithubObjectWithModifiableExtendedListAttribute( TestCaseWithGithubTestObj
self.expectStatusDelete( "/test/a3s/idRemove" ).andReturn( 204 )
self.o.remove_from_a3s( a3ToRemove )
def testHasInList( self ):
a3ToQuery = self.ContainedObject( self.g.object, { "id": "idQuery", "name": "nameQuery" }, lazy = True )
self.expectStatusGet( "/test/a3s/idQuery" ).andReturn( 204 )
self.assertTrue( self.o.has_in_a3s( a3ToQuery ) )
self.expectStatusGet( "/test/a3s/idQuery" ).andReturn( 404 )
self.assertFalse( self.o.has_in_a3s( a3ToQuery ) )
unittest.main()