File indexing completed on 2024-05-19 05:21:55

0001 # Copyright (c) 2019 Alexander Potashev <aspotashev@gmail.com>
0002 #
0003 # This program is free software; you can redistribute it and/or
0004 # modify it under the terms of the GNU General Public License as
0005 # published by the Free Software Foundation; either version 2 of
0006 # the License or (at your option) version 3 or any later version
0007 # accepted by the membership of KDE e.V. (or its successor approved
0008 # by the membership of KDE e.V.), which shall act as a proxy
0009 # defined in Section 14 of version 3 of the license.
0010 #
0011 # This program is distributed in the hope that it will be useful,
0012 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 # GNU General Public License for more details.
0015 #
0016 # You should have received a copy of the GNU General Public License
0017 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 
0019 
0020 def test_delete(app_testfile):
0021     app_testfile.addTask('Task1')
0022     task_id = app_testfile.taskIdsFromName('Task1')[0]
0023     app_testfile.deleteTask(task_id)
0024     assert app_testfile.tasks() == []
0025     assert len(app_testfile.version()) > 0
0026 
0027 
0028 def test_delete_parent(app_testfile):
0029     app_testfile.addTask('Task1')
0030     task_id = app_testfile.taskIdsFromName('Task1')[0]
0031 
0032     app_testfile.addSubTask('blah', task_id)
0033     app_testfile.deleteTask(task_id)
0034 
0035     # Should delete both tasks: parent and child
0036     assert app_testfile.tasks() == []
0037 
0038     assert len(app_testfile.version()) > 0