Ejemplo n.º 1
0
Archivo: base.py Proyecto: flodolo/elmo
            ],
            'debug': False
        }
    },
]

# This is the common prefix displayed in front of ALL static files
STATIC_URL = '/static/'


# the location where all collected files end up.
# the reason for repeated the word 'static' inside 'collected/'
# is so we, in nginx/apache, can set up the root to be
# <base path>/collected
# then a URL like http://domain/static/js/jquery.js just works
STATIC_ROOT = COMPRESS_ROOT = path('collected', 'static')

## Middlewares, apps, URL configs.

# not using funfactory.settings_base.MIDDLEWARE_CLASSES here because there's
# so few things we need and so many things we'd need to add
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'session_csrf.CsrfMiddleware',

    'commonware.middleware.FrameOptionsHeader',
    'commonware.middleware.ScrubRequestOnException',
)
Ejemplo n.º 2
0
 def setUpClass(cls):
     for cron_file in CRONTAB_FILE_NAMES:
         call([
             path('bin', 'gen-crons.py'), '-t', cron_file, '-w',
             '/path/to/www', '-s', '/path/to/src'
         ])
Ejemplo n.º 3
0
 def tearDownClass(cls):
     for cron_file in CRONTAB_FILE_NAMES:
         os.remove(path('etc', 'cron.d', cron_file))
Ejemplo n.º 4
0
            ],
            'debug':
            False
        }
    },
]

# This is the common prefix displayed in front of ALL static files
STATIC_URL = '/static/'

# the location where all collected files end up.
# the reason for repeated the word 'static' inside 'collected/'
# is so we, in nginx/apache, can set up the root to be
# <base path>/collected
# then a URL like http://domain/static/js/jquery.js just works
STATIC_ROOT = COMPRESS_ROOT = path('collected', 'static')

## Middlewares, apps, URL configs.

# not using funfactory.settings_base.MIDDLEWARE_CLASSES here because there's
# so few things we need and so many things we'd need to add
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'session_csrf.CsrfMiddleware',
    'commonware.middleware.FrameOptionsHeader',
    'commonware.middleware.ScrubRequestOnException',
)
Ejemplo n.º 5
0
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
from subprocess import call
from django.test.utils import override_settings
from mock import patch

import chkcrontab_lib as chkcrontab
from funfactory.settings_base import path

from bedrock.base import geo
from bedrock.mozorg.tests import TestCase

CRONTAB_FILE_NAMES = ['bedrock-dev', 'bedrock-stage', 'bedrock-prod']
CRONTAB_FILES = [path('etc', 'cron.d', cf) for cf in CRONTAB_FILE_NAMES]


class TestCrontabFiles(TestCase):
    files_generated = False

    @classmethod
    def setUpClass(cls):
        for cron_file in CRONTAB_FILE_NAMES:
            call([
                path('bin', 'gen-crons.py'), '-t', cron_file, '-w',
                '/path/to/www', '-s', '/path/to/src'
            ])

    @classmethod
    def tearDownClass(cls):
Ejemplo n.º 6
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import glob

import chkcrontab_lib as chkcrontab
from funfactory.settings_base import path

from bedrock.mozorg.tests import TestCase


CRONTAB_FILES = glob.glob(path('etc', 'cron.d', '*'))


class TestCrontabFiles(TestCase):
    def test_crontab_files_have_newlines(self):
        """Crontab files should end with newline character."""
        for filename in CRONTAB_FILES:
            with open(filename) as cronfile:
                self.assertTrue(cronfile.read().endswith('\n'),
                                'No newline at end of ' + filename)

    def test_crontab_files_valid(self):
        """Crontab files should pass validation."""
        for filename in CRONTAB_FILES:
            cronlog = chkcrontab.LogCounter()
            return_value = chkcrontab.check_crontab(filename, cronlog)
            self.assertEqual(return_value, 0, 'Problem with ' + filename)
Ejemplo n.º 7
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import glob

import chkcrontab_lib as chkcrontab
from funfactory.settings_base import path

from bedrock.mozorg.tests import TestCase

CRONTAB_FILES = glob.glob(path('etc', 'cron.d', '*'))


class TestCrontabFiles(TestCase):
    def test_crontab_files_have_newlines(self):
        """Crontab files should end with newline character."""
        for filename in CRONTAB_FILES:
            with open(filename) as cronfile:
                self.assertTrue(cronfile.read().endswith('\n'),
                                'No newline at end of ' + filename)

    def test_crontab_files_valid(self):
        """Crontab files should pass validation."""
        for filename in CRONTAB_FILES:
            cronlog = chkcrontab.LogCounter()
            return_value = chkcrontab.check_crontab(filename, cronlog)
            self.assertEqual(return_value, 0, 'Problem with ' + filename)
Ejemplo n.º 8
0
 def tearDownClass(cls):
     for cron_file in CRONTAB_FILE_NAMES:
         os.remove(path('etc', 'cron.d', cron_file))
Ejemplo n.º 9
0
 def setUpClass(cls):
     for cron_file in CRONTAB_FILE_NAMES:
         call([path('bin', 'gen-crons.py'), '-t', cron_file, '-w', '/path/to/www',
               '-s', '/path/to/src'])
Ejemplo n.º 10
0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
from subprocess import call

import chkcrontab_lib as chkcrontab
from funfactory.settings_base import path

from bedrock.mozorg.tests import TestCase


CRONTAB_FILE_NAMES = ['bedrock-dev', 'bedrock-stage', 'bedrock-prod']
CRONTAB_FILES = [path('etc', 'cron.d', cf) for cf in CRONTAB_FILE_NAMES]


class TestCrontabFiles(TestCase):
    files_generated = False

    @classmethod
    def setUpClass(cls):
        for cron_file in CRONTAB_FILE_NAMES:
            call([path('bin', 'gen-crons.py'), '-t', cron_file, '-w', '/path/to/www',
                  '-s', '/path/to/src'])

    @classmethod
    def tearDownClass(cls):
        for cron_file in CRONTAB_FILE_NAMES:
            os.remove(path('etc', 'cron.d', cron_file))