예제 #1
0
 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"
     )
예제 #2
0
 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},
     )
예제 #3
0
 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},
     )
예제 #4
0
 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",
     )
예제 #5
0
 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
         },
     )
예제 #6
0
    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},
        )
예제 #7
0
    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
            },
        )