Files
edx-platform/pavelib/paver_tests/test_utils.py
Ben Patterson 62df58fafd Firefox version must meet a minimum
This will be a backwards-compatible change, which will allow
developers that use older versions of firefox (e.g., 28) to
continue with development while also supporting a build system
and development that uses newer firefox versions (e.g., 42)
2016-05-11 19:25:17 -04:00

44 lines
1.4 KiB
Python

"""
Tests for pavelib/utils/test/utils
"""
from pavelib.utils.test.utils import check_firefox_version, MINIMUM_FIREFOX_VERSION
import unittest
from mock import patch
class TestUtils(unittest.TestCase):
"""
Test utils.py under pavelib/utils/test
"""
@patch('subprocess.check_output')
def test_firefox_version_ok(self, _mock_subprocesss):
test_version = MINIMUM_FIREFOX_VERSION
_mock_subprocesss.return_value = "Mozilla Firefox {version}".format(
version=str(test_version)
)
# No exception should be raised
check_firefox_version()
@patch('subprocess.check_output')
def test_firefox_version_below_expected(self, _mock_subprocesss):
test_version = MINIMUM_FIREFOX_VERSION - 1
_mock_subprocesss.return_value = "Mozilla Firefox {version}".format(
version=test_version
)
with self.assertRaises(Exception):
check_firefox_version()
@patch('subprocess.check_output')
def test_firefox_version_not_detected(self, _mock_subprocesss):
_mock_subprocesss.return_value = "Mozilla Firefox"
with self.assertRaises(Exception):
check_firefox_version()
@patch('subprocess.check_output')
def test_firefox_version_bad(self, _mock_subprocesss):
_mock_subprocesss.return_value = "garbage"
with self.assertRaises(Exception):
check_firefox_version()