@@ -271,18 +271,19 @@ def testHostnameHasDomain(self):
271271 assert self .g .requester .__hostnameHasDomain ("ghe.local" , "ghe.local" )
272272 assert self .g .requester .__hostnameHasDomain ("api.ghe.local" , "ghe.local" )
273273 assert self .g .requester .__hostnameHasDomain ("api.prod.ghe.local" , "prod.ghe.local" )
274- assert self .g .requester .__hostnameHasDomain ("github.com" , ( "github.com" , "githubusercontent.com" ) )
275- assert self .g .requester .__hostnameHasDomain ("api.github.com" , ( "github.com" , "githubusercontent.com" ) )
276- assert self .g .requester .__hostnameHasDomain ("githubusercontent.com" , ( "github.com" , "githubusercontent.com" ) )
274+ assert self .g .requester .__hostnameHasDomain ("github.com" , [ "github.com" , "githubusercontent.com" ] )
275+ assert self .g .requester .__hostnameHasDomain ("api.github.com" , [ "github.com" , "githubusercontent.com" ] )
276+ assert self .g .requester .__hostnameHasDomain ("githubusercontent.com" , [ "github.com" , "githubusercontent.com" ] )
277277 assert self .g .requester .__hostnameHasDomain (
278- "objects.githubusercontent.com" , ( "github.com" , "githubusercontent.com" )
278+ "objects.githubusercontent.com" , [ "github.com" , "githubusercontent.com" ]
279279 )
280280 assert self .g .requester .__hostnameHasDomain ("maliciousgithub.com" , "github.com" ) is False
281- assert self .g .requester .__hostnameHasDomain ("abc.def" , ( "github.com" , "githubusercontent.com" ) ) is False
281+ assert self .g .requester .__hostnameHasDomain ("abc.def" , [ "github.com" , "githubusercontent.com" ] ) is False
282282
283283 def testAssertUrlAllowed (self ):
284284 # default github.com requester
285285 requester = self .g .requester
286+ self .assertEqual (set (requester .__domains ), {"github.com" , "githubusercontent.com" })
286287
287288 for allowed in [
288289 "https://api.github.com/request" ,
@@ -308,6 +309,7 @@ def testAssertUrlAllowed(self):
308309
309310 # custom (Enterprise) requester with prefix
310311 requester = github .Github (base_url = "https://prod.ghe.local/github-api/" ).requester
312+ self .assertEqual (set (requester .__domains ), {"prod.ghe.local" })
311313
312314 for allowed in [
313315 "https://prod.ghe.local/github-api/request" ,
@@ -337,6 +339,7 @@ def testAssertUrlAllowed(self):
337339
338340 # custom (Enterprise) requester with api subdomain and prefix
339341 requester = github .Github (base_url = "https://api.prod.ghe.local/github-api/" ).requester
342+ self .assertEqual (set (requester .__domains ), {"api.prod.ghe.local" , "prod.ghe.local" })
340343
341344 for allowed in [
342345 "https://api.prod.ghe.local/github-api/request" ,
0 commit comments