Fix recording

This commit is contained in:
Vincent Jacques
2012-05-08 10:52:02 +01:00
parent 2667602079
commit 523f2fdd1d
2 changed files with 4 additions and 6 deletions
+2 -4
View File
@@ -142,14 +142,12 @@ class AuthenticatedUser( TestCase ):
self.assertEqual( self.u.type, "User" )
self.assertEqual( self.u.url, "https://api.github.com/users/jacquev6" )
if len( sys.argv ) > 1:
assert sys.argv[ 1 ] == "--record"
if len( sys.argv ) > 1 and sys.argv[ 1 ] == "--record":
for method in sys.argv[ 2 : ]:
class_, method = method.split( "." )
method = "test" + method
print "Recording method", method, "of class", class_
# exec "testCase = " + class_ + "()"
testCase = AuthenticatedUser( methodName = method )
exec "testCase = " + class_ + "( methodName = method )"
method = getattr( testCase, method )
TestCase.setUp = TestCase.setUpForRecord
testCase.setUp()
@@ -1,5 +1,5 @@
GET /user {} null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e393f72fe6d7bef662f5107437b078c2"'), ('date', 'Tue, 08 May 2012 09:49:03 GMT'), ('content-type', 'application/json; charset=utf-8')]
{"private_gists":5,"type":"User","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","owned_private_repos":5,"blog":"http://vincent-jacques.net","company":"Criteo","following":24,"created_at":"2010-07-09T06:10:06Z","collaborators":0,"login":"jacquev6","disk_usage":16692,"hireable":false,"public_repos":10,"followers":13,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","name":"Vincent Jacques","location":"Paris, France","email":"vincent@vincent-jacques.net","bio":"","public_gists":1,"html_url":"https://github.com/jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"total_private_repos":5,"plan":{"collaborators":1,"space":614400,"name":"micro","private_repos":5}}
[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"79f748546e5fc4492505a70de6542183"'), ('date', 'Tue, 08 May 2012 09:51:20 GMT'), ('content-type', 'application/json; charset=utf-8')]
{"public_repos":10,"type":"User","url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","followers":13,"bio":"","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","disk_usage":16692,"plan":{"private_repos":5,"space":614400,"name":"micro","collaborators":1},"html_url":"https://github.com/jacquev6","blog":"http://vincent-jacques.net","login":"jacquev6","email":"vincent@vincent-jacques.net","created_at":"2010-07-09T06:10:06Z","company":"Criteo","location":"Paris, France","total_private_repos":5,"public_gists":1,"following":24,"name":"Vincent Jacques","id":327146,"owned_private_repos":5,"private_gists":5,"collaborators":0,"hireable":false}