diff --git a/test/columns.t b/test/columns.t index bbba50e86..7a9d2d396 100755 --- a/test/columns.t +++ b/test/columns.t @@ -94,6 +94,7 @@ class TestDescriptionFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id,description.donkey") self.assertEqual(err, "Unrecognized column format 'description.donkey'\n") + class TestUUIDFormats(TestCase): @classmethod def setUpClass(cls): @@ -124,6 +125,7 @@ class TestUUIDFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id,uuid.donkey") self.assertEqual(err, "Unrecognized column format 'uuid.donkey'\n") + class TestUrgencyFormats(TestCase): @classmethod def setUpClass(cls): @@ -153,6 +155,7 @@ class TestUrgencyFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id,urgency.donkey") self.assertEqual(err, "Unrecognized column format 'urgency.donkey'\n") + class TestIDFormats(TestCase): @classmethod def setUpClass(cls): @@ -177,6 +180,7 @@ class TestIDFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id.donkey") self.assertEqual(err, "Unrecognized column format 'id.donkey'\n") + class TestStatusFormats(TestCase): @classmethod def setUpClass(cls): @@ -221,6 +225,7 @@ class TestStatusFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id,status.donkey") self.assertEqual(err, "Unrecognized column format 'status.donkey'\n") + class TestRecurringAttributeFormats(TestCase): @classmethod def setUpClass(cls): @@ -255,6 +260,7 @@ class TestRecurringAttributeFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id,status,due,recur.duration,mask,imask,parent.donkey") self.assertEqual(err, "Unrecognized column format 'parent.donkey'\n") + class TestProjectFormats(TestCase): @classmethod def setUpClass(cls): @@ -296,6 +302,7 @@ class TestProjectFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id,project.donkey,description") self.assertEqual(err, "Unrecognized column format 'project.donkey'\n") + class TestTagsFormats(TestCase): @classmethod def setUpClass(cls): @@ -326,6 +333,7 @@ class TestTagsFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id,tags.donkey,description") self.assertEqual(err, "Unrecognized column format 'tags.donkey'\n") + class TestDateFormats(TestCase): @classmethod def setUpClass(cls): @@ -384,6 +392,24 @@ class TestDateFormats(TestCase): code, out, err = self.t.runError("xxx rc.report.xxx.columns:id,due.donkey,description") self.assertEqual(err, "Unrecognized column format 'due.donkey'\n") + +class TestCustomColumns(TestCase): + def setUp(self): + """Executed before each test in the class""" + self.t = Task() + + def test_unrecognized_column(self): + """verify that using a bogus colum generates an error""" + self.t.config("report.foo.description", "DESC") + self.t.config("report.foo.columns", "id,foo,description") + self.t.config("report.foo.sort", "id+") + self.t.config("report.foo.filter", "project:A") + + # Generate the usage screen, and locate the custom report on it. + code, out, err = self.t.runError("foo") + self.assertIn("Unrecognized column name 'foo'.", err) + + class TestUDAFormats(TestCase): @classmethod def setUpClass(cls): diff --git a/test/custom.columns.t b/test/custom.columns.t deleted file mode 100755 index 673ee690d..000000000 --- a/test/custom.columns.t +++ /dev/null @@ -1,54 +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 => 1; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -# Create the rc file. -if (open my $fh, '>', 'custom.rc') -{ - print $fh "data.location=.\n", - "report.foo.description=DESC\n", - "report.foo.columns=id,foo,description\n", - "report.foo.sort=id+\n", - "report.foo.filter=project:A\n"; - close $fh; -} - -# Generate the usage screen, and locate the custom report on it. -my $output = qx{../src/task rc:custom.rc foo 2>&1 >/dev/null}; -like ($output, qr/Unrecognized column name 'foo'\.\n/, 'custom report spotted invalid column'); - -# Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data custom.rc); -exit 0; -