Beispiel #1
0
def test_django_admin_media_serving_forced_by_setting():
    'settings.LETTUCE_SERVE_ADMIN_MEDIA forces lettuce to serve admin assets'

    os.environ['PYTHONPATH'] = "%s:%s" % (
        FileSystem.join(lib_directory, 'Django-1.3'),
        OLD_PYTHONPATH,
    )

    FileSystem.pushd(current_directory, "django", "grocery")

    extra_args = " --scenarios=1,3,4,5 --settings=settings_without_admin"

    status, out = commands.getstatusoutput(
        "python manage.py harvest --verbosity=2 ./features/ %s" % extra_args)

    assert_equals(status, 0, out)
    FileSystem.popd()

    lines = out.splitlines()

    assert u"Preparing to serve django's admin site static files " \
           "(as per settings.LETTUCE_SERVE_ADMIN_MEDIA=True)..." in lines
    assert u'Running on port 7000 ... OK' in lines
    assert u'Fetching static files ... OK' in lines
    assert u'Fetching CSS files: ... OK' in lines
    assert u'Fetching javascript files: ... OK' in lines
    assert u"Django's builtin server is running at 0.0.0.0:7000" in lines

    # the scenario 2 is not suppose to run
    assert u'Fetching admin media ... OK' not in lines
Beispiel #2
0
def test_django_admin_media_serving_forced_by_setting():
    'settings.LETTUCE_SERVE_ADMIN_MEDIA forces lettuce to serve admin assets'

    os.environ['PYTHONPATH'] = "%s:%s" % (
        FileSystem.join(lib_directory, 'Django-1.3'),
        OLD_PYTHONPATH,
    )

    extra_args = " --scenarios=1,3,4,5 --settings=settings_without_admin"

    status, out = subprocess.getstatusoutput(
        "python manage.py harvest --verbosity=2 ./features/ %s" % extra_args)

    assert_equals(status, 0, out)

    lines = out.splitlines()

    assert "Preparing to serve django's admin site static files " \
           "(as per settings.LETTUCE_SERVE_ADMIN_MEDIA=True)..." in lines
    assert 'Running on port 7000 ... OK' in lines
    assert 'Fetching static files ... OK' in lines
    assert 'Fetching CSS files: ... OK' in lines
    assert 'Fetching javascript files: ... OK' in lines
    assert "Django's builtin server is running at 0.0.0.0:7000" in lines

    # the scenario 2 is not suppose to run
    assert 'Fetching admin media ... OK' not in lines
Beispiel #3
0
def test_django_admin_media_serving_on_django_125():
    'lettuce should serve admin static files properly on Django 1.2.5'

    os.environ['PYTHONPATH'] = "%s:%s" % (
        FileSystem.join(lib_directory, 'Django-1.2.5'),
        OLD_PYTHONPATH,
    )
    FileSystem.pushd(current_directory, "django", "grocery")

    status, out = commands.getstatusoutput(
        "python manage.py harvest --verbosity=2 ./features/")

    assert_equals(status, 0, out)
    FileSystem.popd()

    lines = out.splitlines()
    f = '\n\n'
    f += '*' * 100
    f += '\n' + '\n'.join(lines)

    assert u"Preparing to serve django's admin site static files..." in lines, f
    assert u"Django's builtin server is running at 0.0.0.0:7000" in lines, f
    assert u'Running on port 7000 ... OK' in lines, f
    assert u'Fetching admin media ... OK' in lines, f
    assert u'Fetching static files ... OK' in lines, f
    assert u'Fetching CSS files: ... OK' in lines, f
    assert u'Fetching javascript files: ... OK' in lines, f
Beispiel #4
0
def test_django_admin_media_serving_on_django_125():
    'lettuce should serve admin static files properly on Django 1.2.5'

    os.environ['PYTHONPATH'] = "%s:%s" % (
        FileSystem.join(lib_directory, 'Django-1.2.5'),
        OLD_PYTHONPATH,
    )

    status, out = subprocess.getstatusoutput(
        "python manage.py harvest --verbosity=2 ./features/")

    assert_equals(status, 0, out)

    lines = out.splitlines()
    f = '\n\n'
    f += '*' * 100
    f += '\n' + '\n'.join(lines)

    assert "Preparing to serve django's admin site static files..." in lines, f
    assert "Django's builtin server is running at 0.0.0.0:7000" in lines, f
    assert 'Running on port 7000 ... OK' in lines, f
    assert 'Fetching admin media ... OK' in lines, f
    assert 'Fetching static files ... OK' in lines, f
    assert 'Fetching CSS files: ... OK' in lines, f
    assert 'Fetching javascript files: ... OK' in lines, f
Beispiel #5
0
def test_django_admin_media_serving_on_django_13():
    "lettuce should serve admin static files properly on Django 1.3"

    os.environ["PYTHONPATH"] = "%s:%s" % (FileSystem.join(lib_directory, "Django-1.3"), OLD_PYTHONPATH)

    status, out = commands.getstatusoutput("python manage.py harvest --verbosity=2 ./features/")

    assert_not_equals(status, 0)

    lines = out.splitlines()

    assert u"Preparing to serve django's admin site static files..." in lines
    assert u"Django's builtin server is running at 0.0.0.0:7000" in lines
Beispiel #6
0
def test_django_admin_media_serving_on_django_13():
    'lettuce should serve admin static files properly on Django 1.3'

    os.environ['PYTHONPATH'] = "%s:%s" % (
        FileSystem.join(lib_directory, 'Django-1.3'),
        OLD_PYTHONPATH,
    )

    status, out = subprocess.getstatusoutput(
        "python manage.py harvest --verbosity=2 ./features/")

    assert_not_equals(status, 0)

    lines = out.splitlines()

    assert "Preparing to serve django's admin site static files..." in lines
    assert "Django's builtin server is running at 0.0.0.0:7000" in lines
Beispiel #7
0
def test_django_admin_media_serving_on_django_16():
    'lettuce should serve admin static files properly on Django 1.6' \
    'backward compatibility with an existing test before the port' \
    'targeting django version 1.3'

    os.environ['PYTHONPATH'] = "%s:%s" % (
        FileSystem.join(lib_directory, 'Django-1.6.2'),
        OLD_PYTHONPATH,
    )

    status, out = subprocess.getstatusoutput(
        "%s manage.py harvest --verbosity=2 ./features/" % sys.executable)

    assert_not_equals(status, 0)

    lines = out.splitlines()

    assert "Preparing to serve django's admin site static files..." in lines
    assert "Django's builtin server is running at 0.0.0.0:7000" in lines
Beispiel #8
0
def test_django_admin_media_serving_on_django_13_and_up():
    'lettuce should serve admin static files properly on Django 1.3 and up'

    os.environ['PYTHONPATH'] = "%s:%s" % (
        FileSystem.join(lib_directory, 'Django-1.6.2'),
        OLD_PYTHONPATH,
    )

    status, out = subprocess.getstatusoutput(
        "%s manage.py harvest --verbosity=2 ./features/" % sys.executable)

    assert_equals(status, 0, out)

    lines = out.splitlines()

    assert "Preparing to serve django's admin site static files..." in lines
    assert 'Running on port 7000 ... OK' in lines
    assert 'Fetching admin media ... OK' in lines
    assert 'Fetching static files ... OK' in lines
    assert 'Fetching CSS files: ... OK' in lines
    assert 'Fetching javascript files: ... OK' in lines
    assert "Django's builtin server is running at 0.0.0.0:7000" in lines
Beispiel #9
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import subprocess

from lettuce.fs import FileSystem
from tests.asserts import assert_not_equals

current_directory = FileSystem.dirname(__file__)
lib_directory = FileSystem.join(current_directory,  'lib')


OLD_PYTHONPATH = os.getenv('PYTHONPATH', ':'.join(sys.path))


def teardown():
    os.environ['PYTHONPATH'] = OLD_PYTHONPATH


@FileSystem.in_directory(current_directory, 'django', 'chive')
def test_django_admin_media_serving_on_django_13():
    'lettuce should serve admin static files properly on Django 1.3'

    os.environ['PYTHONPATH'] = "%s:%s" % (
        FileSystem.join(lib_directory, 'Django-1.3'),
Beispiel #10
0
def test_join():
    fs = FileSystem()
    p = fs.join(fs.abspath("."), "test")
    p2 = join(abspath("."), "test")

    assert p == p2, "Expected:\n%r\nGot:\n%r" % (p2, p)
Beispiel #11
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import commands

from lettuce.fs import FileSystem
from tests.asserts import assert_not_equals

current_directory = FileSystem.dirname(__file__)
lib_directory = FileSystem.join(current_directory, "lib")


OLD_PYTHONPATH = os.getenv("PYTHONPATH", ":".join(sys.path))


def teardown():
    os.environ["PYTHONPATH"] = OLD_PYTHONPATH


@FileSystem.in_directory(current_directory, "django", "chive")
def test_django_admin_media_serving_on_django_13():
    "lettuce should serve admin static files properly on Django 1.3"

    os.environ["PYTHONPATH"] = "%s:%s" % (FileSystem.join(lib_directory, "Django-1.3"), OLD_PYTHONPATH)
Beispiel #12
0
def assert_xsd_valid(filename, content):
    xmlschema = etree.XMLSchema(etree.parse(
        open(FileSystem.join(current_directory, 'xunit.xsd'))
    ))
    xmlschema.assertValid(etree.parse(StringIO(content)))