Skip to content

Commit

Permalink
Testing util.conf without settings.d directory
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusFaria committed Mar 23, 2016
1 parent 7794ccc commit 8c6d5fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions colab/utils/tests/settings.d/test.py

This file was deleted.

9 changes: 9 additions & 0 deletions colab/utils/tests/test_conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import os

from django.test import TestCase, override_settings, Client
from django.conf import settings
Expand Down Expand Up @@ -50,6 +51,11 @@ def test_load_py_settings_with_inaccessible_settings(self, mock):
self.assertRaises(InaccessibleSettings, load_py_settings)

def test_load_py_settings_without_settings_d(self):
COLAB_SETTINGS_DIR = ''
if 'COLAB_SETTINGS_DIR' in os.environ:
COLAB_SETTINGS_DIR = os.environ['COLAB_SETTINGS_DIR']
del os.environ['COLAB_SETTINGS_DIR']

py_settings = load_py_settings('/path/fake/settings.d/test.py')

self.assertIn('SOCIAL_NETWORK_ENABLED', py_settings)
Expand All @@ -58,6 +64,9 @@ def test_load_py_settings_without_settings_d(self):
self.assertIn('EMAIL_PORT', py_settings)
self.assertEquals(py_settings['EMAIL_PORT'], 25)

if COLAB_SETTINGS_DIR:
os.environ['COLAB_SETTINGS_DIR'] = COLAB_SETTINGS_DIR

@patch('os.listdir', return_value=[test_files_dir + '/settings.d/test.py',
'non_python_file'])
@patch('colab.utils.conf._load_py_file',
Expand Down

0 comments on commit 8c6d5fd

Please sign in to comment.