Added edge command.

This commit is contained in:
William Pietri
2017-11-04 08:41:27 -07:00
parent d88fbb35b2
commit e633c2be22
2 changed files with 23 additions and 1 deletions
+10 -1
View File
@@ -105,6 +105,10 @@ class Clean(VacBotCommand):
def __init__(self, wait):
super().__init__('clean', {'type': 'auto', 'speed': 'standard'}, wait)
class Edge(VacBotCommand):
def __init__(self, wait):
super().__init__('clean', {'type': 'border', 'speed': 'strong'}, wait)
class Charge(VacBotCommand):
def __init__(self):
@@ -144,11 +148,16 @@ def cli(charge, debug):
logging.basicConfig(level=level, format='%(levelname)-8s %(message)s')
@cli.command(help='cleans for the specified number of minutes')
@cli.command(help='auto-cleans for the specified number of minutes')
@click.argument('minutes', type=click.FLOAT)
def clean(minutes):
return Clean(minutes * 60)
@cli.command(help='cleans room edges for the specified number of minutes')
@click.argument('minutes', type=click.FLOAT)
def edge(minutes):
return Edge(minutes * 60)
@cli.command(help='returns to charger')
def charge():
+13
View File
@@ -4,6 +4,9 @@ from nose.tools import assert_equals
from sucks import *
# There are no tests for the XMPP stuff here because a) it's relatively complicated to test given
# 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_clean_command():
c = Clean(10)
@@ -13,6 +16,16 @@ def test_clean_command():
b'<ctl td="Clean"><clean speed="standard" type="auto" /></ctl>') # protocol has attribs in other order
def test_edge_command():
# called Edge because that's what the UI uses, even though the protocol is different
c = Edge(10)
assert_equals(c.terminal, False)
assert_equals(c.wait, 10)
assert_equals(ElementTree.tostring(c.to_xml()),
b'<ctl td="Clean"><clean speed="strong" type="border" /></ctl>') # protocol has attribs in other order
def test_charge_command():
c = Charge()
assert_equals(c.terminal, True)