From 91f3a595232ca6481135207c503cda69efe8c54a Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Thu, 9 Aug 2012 10:22:04 -0400 Subject: [PATCH] Fixed add_directory() test which were broken. --- core/tests/app_test.py | 12 ++++++++---- core/tests/base.py | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/core/tests/app_test.py b/core/tests/app_test.py index 3d8fff89..f1f721eb 100644 --- a/core/tests/app_test.py +++ b/core/tests/app_test.py @@ -330,18 +330,22 @@ class TestCaseDupeGuruWithResults: app = self.app # any other path that isn't a parent or child of the already added path otherpath = Path(op.dirname(__file__)) - eq_(app.add_directory(otherpath), 0) + app.add_directory(otherpath) eq_(len(app.directories), 2) def test_addDirectory_already_there(self, do_setup): app = self.app otherpath = Path(op.dirname(__file__)) - eq_(app.add_directory(otherpath), 0) - eq_(app.add_directory(otherpath), 1) + app.add_directory(otherpath) + app.add_directory(otherpath) + eq_(len(app.view.messages), 1) + assert "already" in app.view.messages[0] def test_addDirectory_does_not_exist(self, do_setup): app = self.app - eq_(2,app.add_directory('/does_not_exist')) + app.add_directory('/does_not_exist') + eq_(len(app.view.messages), 1) + assert "exist" in app.view.messages[0] def test_ignore(self, do_setup): app = self.app diff --git a/core/tests/base.py b/core/tests/base.py index f99dab43..13c0cd31 100644 --- a/core/tests/base.py +++ b/core/tests/base.py @@ -24,6 +24,9 @@ from ..gui.prioritize_dialog import PrioritizeDialog class DupeGuruView: JOB = nulljob + def __init__(self): + self.messages = [] + def start_job(self, jobid, func, args=()): try: func(self.JOB, *args) @@ -37,7 +40,7 @@ class DupeGuruView: pass def show_message(self, msg): - pass + self.messages.append(msg) def ask_yes_no(self, prompt): return True # always answer yes