Fixed add_directory() test which were broken.

This commit is contained in:
Virgil Dupras 2012-08-09 10:22:04 -04:00
parent 3441e51c0e
commit 91f3a59523
2 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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