Test: merged all recurrence scripts into one

- The new recurrence.t includes all previous tests.
- A list of TODO items at the bottom indicates further needs.
This commit is contained in:
Paul Beckingham 2015-07-18 11:25:47 -04:00
parent d753bb747b
commit a37b5d6213
7 changed files with 234 additions and 428 deletions

View file

@ -1,63 +0,0 @@
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# http://www.opensource.org/licenses/mit-license.php
#
###############################################################################
import sys
import os
import unittest
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task, TestCase
class TestRecurrenceDisabled(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
def test_reccurence_disabled(self):
"""
Test that recurrent tasks are not being generated when recurrence is
disabled.
"""
self.t.config("recurrence", "no")
self.t("add due:today recur:daily Recurrent task.")
# Trigger GC, expect no match and therefore non-zero code
self.t.runError("list")
# Check that no task has been generated.
code, out, err = self.t("task count")
self.assertEqual("0", out.strip())
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
# vim: ai sts=4 et sw=4

View file

@ -1,61 +0,0 @@
#! /usr/bin/env perl
################################################################################
##
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 3;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'};
# Create the rc file.
if (open my $fh, '>', 'recur.rc')
{
print $fh "data.location=.\n",
"defaultwidth=100\n";
close $fh;
}
# Add a recurring task, then see how many future pending tasks are
# generated by default, and by overriding rc.recurrence.limit.
qx{../src/task rc:recur.rc add ONE due:tomorrow recur:weekly 2>&1};
my $output = qx{../src/task rc:recur.rc long 2>&1};
my @tasks = $output =~ /(ONE)/g;
is (scalar @tasks, 1, 'recurrence.limit default to 1');
$output = qx{../src/task rc:recur.rc rc.recurrence.limit:4 long 2>&1};
@tasks = $output =~ /(ONE)/g;
is (scalar @tasks, 4, 'recurrence.limit override to 4');
$output = qx{../src/task rc:recur.rc diag 2>&1};
like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data recur.rc);
exit 0;

View file

@ -1,64 +0,0 @@
#! /usr/bin/env perl
################################################################################
##
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 3;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'};
# Create the rc file.
if (open my $fh, '>', 'recur.rc')
{
print $fh "data.location=.\n",
"report.asc.columns=id,recur,description\n",
"report.asc.sort=recur+\n",
"report.desc.columns=id,recur,description\n",
"report.desc.sort=recur-\n";
close $fh;
}
# Create a few recurring tasks, and test the sort order of the recur column.
qx{../src/task rc:recur.rc add due:tomorrow recur:daily first 2>&1};
qx{../src/task rc:recur.rc add due:tomorrow recur:weekly second 2>&1};
qx{../src/task rc:recur.rc add due:tomorrow recur:3d third 2>&1};
my $output = qx{../src/task rc:recur.rc asc 2>&1};
like ($output, qr/first .* third .* second/msx, 'daily 3d weekly');
$output = qx{../src/task rc:recur.rc desc 2>&1};
like ($output, qr/second .* third .* first/msx, 'weekly 3d daily');
$output = qx{../src/task rc:recur.rc diag 2>&1};
like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data recur.rc);
exit 0;

View file

@ -1,103 +0,0 @@
#! /usr/bin/env perl
################################################################################
##
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 10;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'};
# Create the rc file.
if (open my $fh, '>', 'recur.rc')
{
print $fh "data.location=.\n",
"confirmation=off\n",
"recurrence.limit=1\n";
close $fh;
}
# Create a recurring and non-recurring task.
qx{../src/task rc:recur.rc add simple 2>&1};
qx{../src/task rc:recur.rc add complex due:today recur:daily 2>&1};
# List tasks to generate child tasks. Should result in:
# 1 simple
# 3 complex
# 4 complex
my $output = qx{../src/task rc:recur.rc minimal 2>&1};
like ($output, qr/1.+simple\n/ms, '1 simple');
like ($output, qr/3.+complex\n/ms, '3 complex');
like ($output, qr/4.+complex\n/ms, '4 complex');
# Modify a child task and do not propagate the change.
$output = qx{echo 'n' | ../src/task rc:recur.rc 3 modify complex2 2>&1};
$output = qx{../src/task rc:recur.rc 3 info 2>&1};
like ($output, qr/Description\s+complex2\s/ms, '3 modified');
$output = qx{../src/task rc:recur.rc 4 info 2>&1};
like ($output, qr/Description\s+complex\s/ms, '4 not modified');
# Modify a child task and propagate the change.
$output = qx{echo 'y' | ../src/task rc:recur.rc 3 modify complex3 2>&1};
$output = qx{../src/task rc:recur.rc 3 info 2>&1};
like ($output, qr/Description\s+complex3\s/ms, '3 modified');
$output = qx{../src/task rc:recur.rc 4 info 2>&1};
like ($output, qr/Description\s+complex3\s/ms, '4 not modified');
# Delete a child task, not propagate.
$output = qx{echo 'n' | ../src/task rc:recur.rc 3 delete 2>&1};
like ($output, qr/Deleted 1 task\./, '3 deleted');
# Delete a child task, propagate.
#$output = qx{../src/task rc:recur.rc minimal 2>&1};
#$output = qx{echo 'y' | ../src/task rc:recur.rc 3 delete 2>&1};
#like ($output, qr/Deleted 1 task\./, 'Child + parent deleted');
#$output = qx{../src/task rc:recur.rc minimal 2>&1};
# TODO Delete a recurring task.
#$output = qx{echo 'y' | ../src/task rc:recur.rc 4 delete 2>&1};
# TODO Wait a recurring task
# TODO Upgrade a task to a recurring task
# TODO Downgrade a recurring task to a regular task
# TODO Duplicate a recurring child task
# TODO Duplicate a recurring parent task
$output = qx{../src/task rc:recur.rc diag 2>&1};
like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected');
# Bug 972: A recurrence period of "7" is interpreted as "7s", not "7d" as
# intended.
$output = qx{../src/task rc:recur.rc add foo due:now recur:2 2>&1};
like ($output, qr/The duration value '2' is not supported./, "'recur:2' is not valid");
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data recur.rc);
exit 0;

View file

@ -1,77 +0,0 @@
#! /usr/bin/env perl
################################################################################
##
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 6;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'};
# Create the rc file.
if (open my $fh, '>', 'recur.rc')
{
print $fh "data.location=.\n",
"bulk=10\n",
"dateformat=Y-M-DTH:N:S\n";
close $fh;
}
# Create a few recurring tasks, and test the sort order of the recur column.
if (open my $fh, '>', 'pending.data')
{
my $until = time () - 2;
my $entry = $until - 5;
print $fh <<EOF;
[uuid:"00000000-0000-0000-0000-000000000000" status:"recurring" description:"foo" entry:"$entry" due:"$entry" recur:"PT2S" until:"$until"]
EOF
close $fh;
}
my $output = qx{../src/task rc:recur.rc list 2>&1};
like ($output, qr/^\s+2/ms, 'Found 2');
like ($output, qr/^\s+3/ms, 'Found 3');
like ($output, qr/^\s+4/ms, 'Found 4');
like ($output, qr/^\s+5/ms, 'Found 5');
# There may be more than 4, but we don't care, because they must all now be
# removed.
qx{../src/task rc:recur.rc status:pending and /foo/ done 2>&1};
$output = qx{../src/task rc:recur.rc list 2>&1};
like ($output, qr/and was deleted/, 'Parent task deleted');
$output = qx{../src/task rc:recur.rc diag 2>&1};
like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data recur.rc);
exit 0;

View file

@ -1,60 +0,0 @@
#! /usr/bin/env perl
################################################################################
##
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 3;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'};
# Create the rc file.
if (open my $fh, '>', 'recur.rc')
{
print $fh "data.location=.\n";
close $fh;
}
# Create a few recurring tasks, and test the sort order of the recur column.
qx{../src/task rc:recur.rc add due:friday recur:weekdays one 2>&1};
my $output = qx{../src/task rc:recur.rc list 2>&1};
like ($output, qr/one/, 'recur weekdays');
$output = qx{../src/task rc:recur.rc info 1 2>&1};
like ($output, qr/Recurrence\s+weekdays/, 'task recurs every weekday');
qx{../src/task rc:recur.rc 1 done 2>&1};
$output = qx{../src/task rc:recur.rc list 2>&1};
$output = qx{../src/task rc:recur.rc diag 2>&1};
like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data recur.rc);
exit 0;

234
test/recurrence.t Executable file
View file

@ -0,0 +1,234 @@
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# http://www.opensource.org/licenses/mit-license.php
#
###############################################################################
import sys
import os
import unittest
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task, TestCase
class TestRecurrenceSorting(TestCase):
@classmethod
def setUpClass(cls):
"""Executed once before any test in the class"""
cls.t = Task()
cls.t.config("report.asc.columns", "id,recur,description")
cls.t.config("report.asc.sort", "recur+")
cls.t.config("report.asc.filter", "status:pending")
cls.t.config("report.desc.columns", "id,recur,description")
cls.t.config("report.desc.sort", "recur-")
cls.t.config("report.desc.filter", "status:pending")
cls.t("add one due:tomorrow recur:daily")
cls.t("add two due:tomorrow recur:weekly")
cls.t("add three due:tomorrow recur:3d")
def setUp(self):
"""Executed before each test in the class"""
def test_sort_ascending(self):
"""Verify sorting by 'recur+' is correct"""
code, out, err = self.t("asc rc.verbose:nothing")
self.assertRegexpMatches(out, "4\s+P1D\s+one\s+6\s+P3D\s+three\s+5\s+P7D\s+two")
def test_sort_descending(self):
"""Verify sorting by 'recur-' is correct"""
code, out, err = self.t("desc rc.verbose:nothing")
self.assertRegexpMatches(out, "5\s+P7D\s+two\s+6\s+P3D\s+three\s+4\s+P1D\s+one")
class TestRecurrenceDisabled(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
def test_reccurence_disabled(self):
"""
Test that recurrent tasks are not being generated when recurrence is
disabled.
"""
self.t.config("recurrence", "no")
self.t("add due:today recur:daily Recurrent task.")
# Trigger GC, expect no match and therefore non-zero code
self.t.runError("list")
# Check that no task has been generated.
code, out, err = self.t("task count")
self.assertEqual("0", out.strip())
class TestRecurrenceLimit(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
def test_recurrence_limit(self):
"""Verify that rc.recurrence.limit is obeyed"""
self.t("add one due:tomorrow recur:weekly")
code, out, err = self.t("list")
self.assertEqual(out.count("one"), 1)
code, out, err = self.t("list rc.recurrence.limit:4")
self.assertEqual(out.count("one"), 4)
class TestRecurrenceWeekdays(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
def test_recurrence_weekdays(self):
"""Verify that 'recur:weekdays' skips weekends"""
# Add a 'recur:weekdays' task due on a friday, which forces the next
# instance to be monday, thereby skipping the weekend.
self.t("add due:friday recur:weekdays one")
# Get the original due date as a julian date.
self.t("list") # GC/handleRecurrence
code, friday, err = self.t("_get 2.due.julian")
# Generate the second instance, obtain due date.
self.t ("list rc.recurrence.limit:2") # GC/handleRecurrence
code, monday, err = self.t("_get 3.due.julian")
# The due dates should be Friday and Monday, three days apart,
# having skipped the weekend.
self.assertEqual(int(friday.strip()) + 3, int(monday.strip()))
class TestRecurrenceUntil(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
def test_recurrence_until(self):
"""Verify that an 'until' date terminates recurrence"""
self.t("add one due:now+1minute recur:PT1H until:now+125minutes")
code, out, err = self.t("list rc.verbose:nothing")
self.assertEqual(out.count("one"), 1)
# All three expected tasks are shown:
# - PT1M
# - PT61M
# - PT121M
# - Nothing after PT125M
self.t.faketime("+3h")
code, out, err = self.t("list rc.verbose:nothing")
self.assertEqual(out.count("one"), 3)
# This test currently failing, probably because the 'until' is
# propagated to the instances, and expires them also. This is certainly
# the way it has been behaving for a while, but is not the original
# intention. Perhaps it is now the de facto functionality, in which
# change the 3 to a 0.
self.t.faketime("+24h")
code, out, err = self.t("list rc.verbose:nothing")
self.assertEqual(out.count("one"), 3)
class TestRecurrenceTasks(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
self.t("add simple")
self.t("add complex due:today recur:daily")
def test_change_propagation(self):
"""Verify that changes (modify, delete) are propagated correctly"""
# List tasks to generate child tasks. Should result in:
# 1 simple
# 3 complex
# 4 complex
code, out, err = self.t("minimal rc.verbose:nothing")
self.assertRegexpMatches(out, "1\s+simple")
self.assertRegexpMatches(out, "3\s+complex")
self.assertRegexpMatches(out, "4\s+complex")
# Modify a child task and do not propagate the change.
self.t("3 modify complex2", input="n\n")
code, out, err = self.t("_get 3.description")
self.assertEqual("complex2\n", out)
code, out, err = self.t("_get 4.description")
self.assertEqual("complex\n", out)
# Modify a child task and propagate the change.
self.t("3 modify complex3", input="y\n")
code, out, err = self.t("_get 3.description")
self.assertEqual("complex3\n", out)
code, out, err = self.t("_get 4.description")
self.assertEqual("complex3\n", out)
# Delete a child task, do not propagate.
code, out, err = self.t("3 delete", input="n\n")
self.assertIn("Deleted 1 task.", out)
# Delete a child task, propagate.
self.t("minimal")
code, out, err = self.t("3 delete", input="y\n")
self.assertIn("Deleted 1 task.", out)
# Check for duplicate UUIDs.
code, out, err = self.t("diag")
self.assertIn("No duplicates found", out)
class TestBug972(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
def test_interpretation_of_seven(self):
"""Bug 972: A recurrence period of "7" is interpreted as "7s", not "7d"
as intended.
"""
code, out, err = self.t.runError("add one due:now recur:2")
self.assertIn("The duration value '2' is not supported.", err)
# TODO Delete a parent recurring task.
# TODO Wait a recurring task
# TODO Upgrade a task to a recurring task
# TODO Upgrade a task to a recurring task, but omit the due date (error handling)
# TODO Downgrade a recurring task to a regular task
# TODO Duplicate a recurring child task
# TODO Duplicate a recurring parent task
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
# vim: ai sts=4 et sw=4