From da6f9ef46465fe9ab44fd5b208cb1f0bd1ceefbd Mon Sep 17 00:00:00 2001 From: Greg Laabs Date: Sat, 9 Dec 2017 13:10:34 -0800 Subject: [PATCH] Add tests for the command formatting changes Tests preserving the CamelCasing of commands, and support for zero args --- tests/test_vacbot.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_vacbot.py b/tests/test_vacbot.py index 163be6a..95e6555 100644 --- a/tests/test_vacbot.py +++ b/tests/test_vacbot.py @@ -10,6 +10,20 @@ from sucks import * # the library's design and its multithreaded nature, and b) I'm manually testing every change anyhow, # as it's not clear how the robot really behaves. +def test_custom_command(): + # Ensure a custom-built command generates the expected XML payload + c = VacBotCommand('CustomCommand', {'type': 'customtype'}) + assert_equals(ElementTree.tostring(c.to_xml()), + + b'') + +def test_custom_command_noargs(): + # Ensure a custom-built command with no args generates XML without an args element + c = VacBotCommand('CustomCommand') + assert_equals(ElementTree.tostring(c.to_xml()), + b'') + + def test_clean_command(): c = Clean(10) assert_equals(c.terminal, False)