class TestProtocolRandomStrings(TestCase): def setUp(self) -> None: self.client = Client() self.client.connect() def tearDown(self) -> None: self.client.disconnect() def test_echo_5_byte_string(self) -> None: for string in generate_random_string(num_strings=5, len_strings=5): with self.subTest(): self.assertEqual(string, self.client.send(string)) def test_echo_10_byte_string(self) -> None: for string in generate_random_string(num_strings=5, len_strings=10): with self.subTest(): self.assertEqual(string, self.client.send(string)) def test_echo_15_byte_string(self) -> None: for string in generate_random_string(num_strings=5, len_strings=15): with self.subTest(): self.assertEqual(string, self.client.send(string))
def wrap_send(test_string: str, client: Client) -> dict: return { 'outgoing_message': test_string, 'returning_message': client.send(test_string) }