From c56e0b5feea6450fe33339fb7d82ad2ef62f0284 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 14 Oct 2020 19:58:39 +0200 Subject: Add unittest for send data Signed-off-by: Olivier Gayot --- tests/test_solter.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/test_solter.py (limited to 'tests') diff --git a/tests/test_solter.py b/tests/test_solter.py new file mode 100644 index 0000000..5166a4f --- /dev/null +++ b/tests/test_solter.py @@ -0,0 +1,15 @@ +import unittest +import solter + + +class TestSolter(unittest.TestCase): + def test_get_commands_send_data(self): + expected = ['call (int)send(3, "Hello World", 11, 0x4000)'] + + self.assertEqual(solter.get_commands_send_data(sockfd=3, data="Hello World"), expected) + + with self.assertRaises(ValueError): + solter.get_commands_send_data(sockfd=3, data='Hello"World') + + with self.assertRaises(ValueError): + solter.get_commands_send_data(sockfd=3, data='Hello\nWorld') -- cgit v1.2.3