Expanded the check_directory_exists() test.

This commit is contained in:
Raoul Snyman 2012-12-07 21:08:28 +02:00
parent 4de4a1823c
commit 93fd476383

View File

@ -143,3 +143,15 @@ class TestLibModule(TestCase):
mocked_exists.assert_called_with(directory_to_check)
mocked_makedirs.assert_called_with(directory_to_check)
# WHEN: os.path.exists raises an IOError
mocked_exists.side_effect = IOError()
check_directory_exists(directory_to_check)
# THEN: We shouldn't get an exception though the mocked exists has been called
mocked_exists.assert_called_with(directory_to_check)
# WHEN: Some other exception is raised
mocked_exists.side_effect = ValueError()
# THEN: check_directory_exists raises an exception
self.assertRaises(ValueError, check_directory_exists, directory_to_check)