def test_uncancellable_disconnect(self) -> None: """Test that handlers without the `@cancellable` flag cannot be cancelled.""" channel = make_request( self.reactor, self.site, "POST", "/sleep", await_result=False ) test_disconnect( self.reactor, channel, expect_cancellation=False, expected_body=b"ok" )
def test_cancellable_disconnect(self) -> None: """Test that handlers with the `@cancellable` flag can be cancelled.""" channel = self.make_request("GET", "/sleep", await_result=False) test_disconnect( self.reactor, channel, expect_cancellation=True, expected_body={"error": "Request cancelled", "errcode": Codes.UNKNOWN}, )
def test_uncancellable_disconnect(self) -> None: """Test that handlers without the `@cancellable` flag cannot be cancelled.""" path = f"{REPLICATION_PREFIX}/{UncancellableReplicationEndpoint.NAME}/" channel = self.make_request("POST", path, await_result=False) test_disconnect( self.reactor, channel, expect_cancellation=False, expected_body={"result": True}, )
def test_cancellable_disconnect(self) -> None: """Test that handlers with the `@cancellable` flag can be cancelled.""" channel = make_request( self.reactor, self.site, "GET", "/sleep", await_result=False ) test_disconnect( self.reactor, channel, expect_cancellation=True, expected_body=b"499 Request cancelled", )
def test_cancellable_disconnect(self) -> None: """Test that handlers with the `@cancellable` flag can be cancelled.""" path = f"{REPLICATION_PREFIX}/{CancellableReplicationEndpoint.NAME}/" channel = self.make_request("POST", path, await_result=False) test_disconnect( self.reactor, channel, expect_cancellation=True, expected_body={ "error": "Request cancelled", "errcode": Codes.UNKNOWN }, )
def test_uncancellable_disconnect(self) -> None: """Test that handlers without the `@cancellable` flag cannot be cancelled.""" channel = self.make_signed_federation_request( "POST", self.path, content={}, await_result=False, ) # Advance past all the rate limiting logic. If we disconnect too early, the # request won't be processed. self.pump() test_disconnect( self.reactor, channel, expect_cancellation=False, expected_body={"result": True}, )
def test_cancellable_disconnect(self) -> None: """Test that handlers with the `@cancellable` flag can be cancelled.""" channel = self.make_signed_federation_request("GET", self.path, await_result=False) # Advance past all the rate limiting logic. If we disconnect too early, the # request won't be processed. self.pump() test_disconnect( self.reactor, channel, expect_cancellation=True, expected_body={ "error": "Request cancelled", "errcode": Codes.UNKNOWN }, )