diff --git a/sucks.py b/sucks.py index 3247979..0471d08 100644 --- a/sucks.py +++ b/sucks.py @@ -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(): diff --git a/test_sucks.py b/test_sucks.py index 6ec5f8a..36e4543 100644 --- a/test_sucks.py +++ b/test_sucks.py @@ -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'') # 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'') # protocol has attribs in other order + + def test_charge_command(): c = Charge() assert_equals(c.terminal, True)