Moved the _get_frozen_path() test to the proper test case.

This commit is contained in:
Raoul Snyman 2012-12-07 22:52:55 +02:00
parent e5b8a1b1ad
commit 000b06ffe6
2 changed files with 17 additions and 17 deletions

View File

@ -11,22 +11,6 @@ class TestAppLocation(TestCase):
"""
A test suite to test out various methods around the AppLocation class.
"""
def get_frozen_path_test(self):
"""
Test the _get_frozen_path() function
"""
with patch(u'openlp.core.utils.sys') as mocked_sys:
# GIVEN: The sys module "without" a "frozen" attribute
mocked_sys.frozen = None
# WHEN: We call _get_frozen_path() with two parameters
# THEN: The non-frozen parameter is returned
assert _get_frozen_path(u'frozen', u'not frozen') == u'not frozen', u'Should return "not frozen"'
# GIVEN: The sys module *with* a "frozen" attribute
mocked_sys.frozen = 1
# WHEN: We call _get_frozen_path() with two parameters
# THEN: The frozen parameter is returned
assert _get_frozen_path(u'frozen', u'not frozen') == u'frozen', u'Should return "frozen"'
def get_data_path_test(self):
"""
Test the AppLocation.get_data_path() method

View File

@ -5,7 +5,7 @@ from unittest import TestCase
from mock import patch
from openlp.core.utils import get_filesystem_encoding
from openlp.core.utils import get_filesystem_encoding, _get_frozen_path
class TestUtils(TestCase):
"""
@ -17,3 +17,19 @@ class TestUtils(TestCase):
"""
assert False, u'This test needs to be written'
def get_frozen_path_test(self):
"""
Test the _get_frozen_path() function
"""
with patch(u'openlp.core.utils.sys') as mocked_sys:
# GIVEN: The sys module "without" a "frozen" attribute
mocked_sys.frozen = None
# WHEN: We call _get_frozen_path() with two parameters
# THEN: The non-frozen parameter is returned
assert _get_frozen_path(u'frozen', u'not frozen') == u'not frozen', u'Should return "not frozen"'
# GIVEN: The sys module *with* a "frozen" attribute
mocked_sys.frozen = 1
# WHEN: We call _get_frozen_path() with two parameters
# THEN: The frozen parameter is returned
assert _get_frozen_path(u'frozen', u'not frozen') == u'frozen', u'Should return "frozen"'