forked from openlp/openlp
Moved the _get_frozen_path() test to the proper test case.
This commit is contained in:
parent
e5b8a1b1ad
commit
000b06ffe6
@ -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
|
||||
|
@ -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"'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user