Raise on 404 error when getting data

This commit is contained in:
Vincent Jacques
2012-02-18 04:39:41 +00:00
parent 439e43233e
commit 74618d316e
2 changed files with 13 additions and 2 deletions
+6 -1
View File
@@ -3,7 +3,7 @@ import MockMockMock
import httplib
import base64
from Github import Github
from Github import Github, UnknownGithubObject
class TestCase( unittest.TestCase ):
def setUp( self ):
@@ -40,4 +40,9 @@ class TestCase( unittest.TestCase ):
self.expect( "GET", "/test", "null", 200, [], '{ "foo": "bar" }' )
self.assertEqual( self.g._dataRequest( "GET", "/test", None, None ), { "foo" : "bar" } )
def testDataOnBadStatus( self ):
self.expect( "GET", "/test", "null", 404, [], '{ "foo": "bar" }' )
with self.assertRaises( UnknownGithubObject ):
self.g._dataRequest( "GET", "/test", None, None )
unittest.main()