mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 03:11:09 +00:00
Restore test coverage
This commit is contained in:
@@ -103,4 +103,10 @@ class TestCase( unittest.TestCase ):
|
||||
p.merge()
|
||||
self.assertTrue( p.is_merged() )
|
||||
|
||||
def testRepositoryCompare( self ):
|
||||
self.requester.expect.dataRequest( "GET", "/user", None, None ).andReturn( { "login": "xxx" } )
|
||||
self.requester.expect.dataRequest( "GET", "/repos/xxx/yyy", None, None ).andReturn( { "name": "yyy", "owner": { "login": "xxx" } } )
|
||||
self.requester.expect.dataRequest( "GET", "/repos/xxx/yyy/compare/foo...bar", None, None ).andReturn( { "gabu": "zomeuh" } )
|
||||
self.assertEqual( self.g.get_user().get_repo( "yyy" ).compare( "foo", "bar" ), { "gabu": "zomeuh" } )
|
||||
|
||||
unittest.main()
|
||||
|
||||
@@ -530,6 +530,26 @@ class GithubObjectWithMethodFromCallable( TestCaseWithGithubTestObject ):
|
||||
self.assertEqual( self.o.myMethod( mock.object, 42 ), 72 )
|
||||
mock.tearDown()
|
||||
|
||||
def myOtherCallable( obj, mock, **kwds ):
|
||||
return mock.call( **kwds )
|
||||
class GithubObjectWithMethodFromCallableWithAlternative( TestCaseWithGithubTestObject ):
|
||||
GithubTestObject = GithubObject(
|
||||
"GithubTestObject",
|
||||
BaseUrl( lambda obj: "/test" ),
|
||||
InternalSimpleAttributes( "a1", "a2" ),
|
||||
MethodFromCallable( "myMethod", Alternative( Parameters( [ "mock", "x1", "x2" ], [ "x3" ] ), Parameters( [ "mock", "y1" ], [ "y2" ] ) ), myOtherCallable, SimpleTypePolicy( None ) )
|
||||
)
|
||||
|
||||
def testCallMethod( self ):
|
||||
mock = MockMockMock.Mock( "myOtherCallable" )
|
||||
mock.expect.call( x1 = 1, x2 = 2, x3 = 3 ).andReturn( 72 )
|
||||
self.assertEqual( self.o.myMethod( mock.object, 1, 2, 3 ), 72 )
|
||||
mock.expect.call( x1 = 1, x2 = 2 ).andReturn( 73 )
|
||||
self.assertEqual( self.o.myMethod( mock.object, 1, 2 ), 73 )
|
||||
mock.expect.call( y1 = 1 ).andReturn( 42 )
|
||||
self.assertEqual( self.o.myMethod( mock.object, 1 ), 42 )
|
||||
mock.tearDown()
|
||||
|
||||
class GithubObjectWithSeveralInternalSimpleAttributesAndInternalObjectAttributes( TestCaseWithGithubTestObject ):
|
||||
ContainedObject = GithubObject(
|
||||
"ContainedObject",
|
||||
|
||||
Reference in New Issue
Block a user