Forgot to mock out another method.

This commit is contained in:
Raoul Snyman 2012-12-05 22:55:28 +02:00
parent ee6495e08f
commit 0483fdc8ea

View File

@ -54,11 +54,13 @@ class TestAppLocation(TestCase):
""" """
Test the AppLocation.get_data_path() method when a custom location is set in the settings Test the AppLocation.get_data_path() method when a custom location is set in the settings
""" """
with patch(u'openlp.core.utils.Settings') as mocked_class: with patch(u'openlp.core.utils.Settings') as mocked_class,\
patch(u'openlp.core.utils.os') as mocked_os:
# GIVEN: A mocked out Settings class which returns a custom data location # GIVEN: A mocked out Settings class which returns a custom data location
mocked_settings = mocked_class.return_value mocked_settings = mocked_class.return_value
mocked_settings.contains.return_value = True mocked_settings.contains.return_value = True
mocked_settings.value.return_value.toString.return_value = u'custom/dir' mocked_settings.value.return_value.toString.return_value = u'custom/dir'
mocked_os.path.normpath.return_value = u'custom/dir'
# WHEN: we call AppLocation.get_data_path() # WHEN: we call AppLocation.get_data_path()
data_path = AppLocation.get_data_path() data_path = AppLocation.get_data_path()
# THEN: the mocked Settings methods were called and the value returned was our set up value # THEN: the mocked Settings methods were called and the value returned was our set up value