MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / testLoggingWithBasicAuthentication

Method testLoggingWithBasicAuthentication

tests/Logging_.py:100–125  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

98 self.assertEqual(self.logger.output, output)
99
100 def testLoggingWithBasicAuthentication(self):
101 self.assertEqual(github.Github(auth=Login("login", "password")).get_user().name, "Vincent Jacques")
102 url = "https://api.github.com/user"
103 requestHeaders = {
104 "Authorization": "Basic (login and password removed)",
105 "User-Agent": "PyGithub/Python",
106 }
107 responseHeaders = {
108 "status": "200 OK",
109 "content-length": "806",
110 "x-github-media-type": "github.beta; format=json",
111 "x-content-type-options": "nosniff",
112 "x-ratelimit-limit": "5000",
113 "vary": "Accept, Authorization, Cookie",
114 "x-ratelimit-remaining": "4993",
115 "server": "nginx",
116 "last-modified": "Fri, 14 Sep 2012 18:47:46 GMT",
117 "connection": "keep-alive",
118 "etag": '"434dfe5d3f50558fe3cea087cb95c401"',
119 "cache-control": "private, s-maxage=60, max-age=60",
120 "date": "Mon, 17 Sep 2012 17:12:32 GMT",
121 "content-type": "application/json; charset=utf-8",
122 "DEBUG_FRAME": 0,
123 }
124 output = '{"owned_private_repos":3,"disk_usage":18612,"following":28,"type":"User","public_repos":13,"location":"Paris, France","company":"Criteo","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","plan":{"space":614400,"private_repos":5,"name":"micro","collaborators":1},"blog":"http://vincent-jacques.net","login":"jacquev6","public_gists":3,"html_url":"https://github.com/jacquev6","hireable":false,"created_at":"2010-07-09T06:10:06Z","private_gists":5,"followers":13,"name":"Vincent Jacques","email":"vincent@vincent-jacques.net","bio":"","total_private_repos":3,"collaborators":0,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"}'
125 self.assertLogging("GET", url, requestHeaders, responseHeaders, output)
126
127 def testLoggingWithOAuthAuthentication(self):
128 self.assertEqual(github.Github(auth=self.oauth_token).get_user().name, "Vincent Jacques")

Callers

nothing calls this directly

Calls 3

assertLoggingMethod · 0.95
LoginClass · 0.90
get_userMethod · 0.80

Tested by

no test coverage detected