Skip to content

Commit

Permalink
Merge branch 'develop' into feature/issue-901-better-index-page-next-…
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
jerith committed Jan 31, 2015
2 parents 86dd92c + 041966d commit 8c2382b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions vumi/application/tests/test_sandbox.py
Expand Up @@ -952,11 +952,22 @@ def set_agent(self, agent):
self.agent = agent

def get_context_factory(self):
# This test's behaviour depends on the version of Twisted being used.
if HttpClientPolicyForHTTPS is None:
# We need to dig around inside our Agent to find the context factory.
# Since this involves private attributes that have changed a few times
# recently, we need to try various options.
if hasattr(self.agent, "_contextFactory"):
# For Twisted 13.x
return self.agent._contextFactory
else:
elif hasattr(self.agent, "_policyForHTTPS"):
# For Twisted 14.x
return self.agent._policyForHTTPS
elif hasattr(self.agent, "_endpointFactory"):
# For Twisted 15.0.0 (and possibly newer)
return self.agent._endpointFactory._policyForHTTPS
else:
raise NotImplementedError(
"I can't find the context factory on this Agent. This seems"
" to change every few versions of Twisted.")

def fail_next(self, error):
self._next_http_request_result = fail(error)
Expand Down

0 comments on commit 8c2382b

Please sign in to comment.