mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
remove unused FakeResponse (#8864)
This commit is contained in:
parent
30fba62108
commit
f347f0cd58
1
changelog.d/8864.misc
Normal file
1
changelog.d/8864.misc
Normal file
@ -0,0 +1 @@
|
||||
Remove unused `FakeResponse` class from unit tests.
|
@ -18,41 +18,15 @@ import re
|
||||
|
||||
from mock import patch
|
||||
|
||||
import attr
|
||||
|
||||
from twisted.internet._resolver import HostResolution
|
||||
from twisted.internet.address import IPv4Address, IPv6Address
|
||||
from twisted.internet.error import DNSLookupError
|
||||
from twisted.python.failure import Failure
|
||||
from twisted.test.proto_helpers import AccumulatingProtocol
|
||||
from twisted.web._newclient import ResponseDone
|
||||
|
||||
from tests import unittest
|
||||
from tests.server import FakeTransport
|
||||
|
||||
|
||||
@attr.s
|
||||
class FakeResponse:
|
||||
version = attr.ib()
|
||||
code = attr.ib()
|
||||
phrase = attr.ib()
|
||||
headers = attr.ib()
|
||||
body = attr.ib()
|
||||
absoluteURI = attr.ib()
|
||||
|
||||
@property
|
||||
def request(self):
|
||||
@attr.s
|
||||
class FakeTransport:
|
||||
absoluteURI = self.absoluteURI
|
||||
|
||||
return FakeTransport()
|
||||
|
||||
def deliverBody(self, protocol):
|
||||
protocol.dataReceived(self.body)
|
||||
protocol.connectionLost(Failure(ResponseDone()))
|
||||
|
||||
|
||||
class URLPreviewTests(unittest.HomeserverTestCase):
|
||||
|
||||
hijack_auth = True
|
||||
|
Loading…
Reference in New Issue
Block a user