Skip to content

Instantly share code, notes, and snippets.

@Fenn-CS
Last active August 16, 2021 11:04
Show Gist options
  • Save Fenn-CS/e922c5fcb80db21b86269caa1bf631c9 to your computer and use it in GitHub Desktop.
Save Fenn-CS/e922c5fcb80db21b86269caa1bf631c9 to your computer and use it in GitHub Desktop.
AttributeError: 'tuple' object has no attribute 'addCallbacks' [Twisted]
Traceback (most recent call last):
Failure: testtools.testresult.real._StringException: Traceback (most recent call last):
File "/home/fenn/opensource/tahoe/tahoe-lafs/venv/lib/python2.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred
result = f(*args, **kw)
File "/home/fenn/opensource/tahoe/tahoe-lafs/venv/lib/python2.7/site-packages/testtools/testcase.py", line 723, in _run_test_method
return self._get_test_method()()
File "/home/fenn/opensource/tahoe/tahoe-lafs/src/allmydata/test/eliotutil.py", line 179, in run_with_logging
return test_method(*args, **kwargs)
File "/home/fenn/opensource/tahoe/tahoe-lafs/src/allmydata/test/web/test_root.py", line 111, in test_invalid
succeeded(AfterPreprocessing(bytes, Equals(b"Invalid capability"))),
File "/home/fenn/opensource/tahoe/tahoe-lafs/venv/lib/python2.7/site-packages/testtools/testcase.py", line 500, in assertThat
mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
File "/home/fenn/opensource/tahoe/tahoe-lafs/venv/lib/python2.7/site-packages/testtools/testcase.py", line 551, in _matchHelper
mismatch = matcher.match(matchee)
File "/home/fenn/opensource/tahoe/tahoe-lafs/venv/lib/python2.7/site-packages/testtools/twistedsupport/_matchers.py", line 101, in match
on_no_result=self._got_no_result,
File "/home/fenn/opensource/tahoe/tahoe-lafs/venv/lib/python2.7/site-packages/testtools/twistedsupport/_deferred.py", line 86, in on_deferred_result
deferred.addCallbacks(
AttributeError: 'tuple' object has no attribute 'addCallbacks'
class RenderSlashUri(SyncTestCase):
"""
Ensure that URIs starting with /uri?uri= only accept valid
capabilities
"""
def setUp(self):
self.client = object()
self.res = URIHandler(self.client)
super(RenderSlashUri, self).setUp()
def test_invalid(self):
"""
A syntactically invalid capbility results in an error.
"""
query_args = {b"uri": [b"not a capability"]}
response_body = render(self.res, query_args),
self.assertThat(
response_body,
succeeded(AfterPreprocessing(bytes, Equals(b"Invalid capability"))),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment