Пример #1
0
 async def inner_test() -> None:
     async with TestServer(ip="::1") as sa:
         ip, port = sa.ip, sa.port
         assert ip and port
         async with get_client(TestingService, host=ip, port=port) as client:
             options = RpcOptions()
             options.set_header("from client", "with love")
             self.assertFalse(await client.invert(True, rpc_options=options))
             self.assertIn("from server", options.read_headers)
Пример #2
0
 def test_write_headers(self) -> None:
     options = RpcOptions()
     headers = options.write_headers
     self.assertIsInstance(headers, WriteHeaders)
     options.set_header("test", "test")
     self.assertTrue(options.write_headers is headers)
     self.assertIn("test", headers)
     self.assertEqual(headers["test"], "test")
     with self.assertRaises(TypeError):
         options.set_header("count", 1)  # type: ignore
Пример #3
0
 def test_write_headers(self) -> None:
     options = RpcOptions()
     headers = options.write_headers
     self.assertIsInstance(headers, WriteHeaders)
     options.set_header("test", "test")
     self.assertTrue(options.write_headers is headers)
     self.assertIn("test", headers)
     self.assertEqual(headers["test"], "test")
     with self.assertRaises(TypeError):
         # pyre-fixme[6]: Expected `str` for 2nd param but got `int`.
         options.set_header("count", 1)