| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from __future__ import absolute_import |
||
| 2 | # Project imports |
||
| 3 | |||
| 4 | import os |
||
| 5 | import sys |
||
| 6 | import unittest |
||
| 7 | |||
| 8 | try: |
||
| 9 | reload # Python 2.7 |
||
|
|
|||
| 10 | except NameError: |
||
| 11 | try: |
||
| 12 | from importlib import reload # Python 3.4+ |
||
| 13 | except ImportError: |
||
| 14 | from imp import reload # Python 3.0 - 3.3 |
||
| 15 | |||
| 16 | from mock import patch |
||
| 17 | |||
| 18 | sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))) |
||
| 19 | |||
| 20 | from elodie import constants |
||
| 21 | |||
| 22 | BASE_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) |
||
| 23 | |||
| 24 | def test_debug(): |
||
| 25 | assert constants.debug == False, constants.debug |
||
| 26 | |||
| 27 | def test_application_directory_default(): |
||
| 28 | reload(constants) |
||
| 29 | expected_path = '{}/.elodie'.format(os.path.expanduser('~')) |
||
| 30 | assert constants.application_directory == expected_path, constants.application_directory |
||
| 31 | |||
| 32 | def test_application_directory_override_invalid(): |
||
| 33 | os.environ['ELODIE_APPLICATION_DIRECTORY'] = '/foo/bar' |
||
| 34 | reload(constants) |
||
| 35 | expected_path = '{}/.elodie'.format(os.path.expanduser('~')) |
||
| 36 | assert constants.application_directory == expected_path, constants.application_directory |
||
| 37 | |||
| 38 | def test_application_directory_override_valid(): |
||
| 39 | os.environ['ELODIE_APPLICATION_DIRECTORY'] = os.getcwd() |
||
| 40 | reload(constants) |
||
| 41 | expected_path = os.getcwd() |
||
| 42 | print expected_path |
||
| 43 | assert constants.application_directory == expected_path, constants.application_directory |
||
| 44 |