diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-10-14 19:58:39 +0200 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-10-14 20:33:28 +0200 |
commit | c56e0b5feea6450fe33339fb7d82ad2ef62f0284 (patch) | |
tree | 38e6e874f965986e1b04868f85726681aa9b4b9e | |
parent | a4e68f0d752d81ee2aa2c0943326bd519ada13fc (diff) |
Add unittest for send data
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r-- | tests/test_solter.py | 15 |
1 files changed, 15 insertions, 0 deletions
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') |