Exemple #1
0
def test_email():
    "lettuce should be able to receive emails sent from django server"
    os.environ["PYTHONPATH"] = current_directory
    os.environ["DJANGO_SETTINGS_MODULE"] = "djangoapp"

    status, out = subprocess.getstatusoutput("django-admin.py harvest email.feature --verbosity=2")

    assert_not_equals(status, 0)
Exemple #2
0
def test_email():
    'lettuce should be able to receive emails sent from django server'
    os.environ['PYTHONPATH'] = current_directory
    os.environ['DJANGO_SETTINGS_MODULE'] = 'djangoapp'

    status, out = commands.getstatusoutput(
        "django-admin.py harvest email.feature --verbosity=2")

    assert_not_equals(status, 0)
Exemple #3
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
Exemple #4
0
def test_django_admin_media_serving():
    'serving admin media in django projects that have "admin" in INSTALLED_APPS'

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

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

    lines = out.splitlines()

    assert_not_equals(re.match(r"Creating test database for alias '\w+'\.\.\.",lines[0]), None)
    assert_equals(lines[1], u"Preparing to server django's admin site static files...")
    assert_not_equals(re.match(r"Django's builtin server is running at 0\.0\.0\.0:\d+",lines[2]), None)
Exemple #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 = 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
Exemple #6
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
Exemple #7
0
def test_django_background_server_running_in_background_with_custom_port():
    'the harvest command should take a --port argument'

    server = multiprocessing.Process(target=runserver_9889)
    server.start()
    time.sleep(1)  # the child process take some time to get up

    e = 'Lettuce could not run the builtin Django server at 0.0.0.0:9889"\n' \
        'maybe you forgot a "runserver" instance running ?\n\n' \
        'well if you really do not want lettuce to run the server ' \
        'for you, then just run:\n\n' \
        'python manage.py --no-server'

    try:
        status, out = subprocess.getstatusoutput(
            "%s manage.py harvest --verbosity=3 --port=9889" % (python_path,))
        assert_equals(out, e)
        assert_not_equals(status, 0)

    finally:
        os.kill(server.pid, 9)
Exemple #8
0
def test_django_background_server_running_in_background():
    'the django builtin server fails if the HTTP port is not available'

    server = multiprocessing.Process(target=runserver_8000)
    server.start()
    time.sleep(1)  # the child process take some time to get up

    e = 'Lettuce could not run the builtin Django server at 0.0.0.0:8000"\n' \
        'maybe you forgot a "runserver" instance running ?\n\n' \
        'well if you really do not want lettuce to run the server ' \
        'for you, then just run:\n\n' \
        'python manage.py --no-server'

    try:
        status, out = subprocess.getstatusoutput(
            "%s manage.py harvest --verbosity=3" % (python_path,))

        assert_equals(out, e)
        assert_not_equals(status, 0)
    finally:
        os.kill(server.pid, 9)
Exemple #9
0
def test_django_background_server_running_in_background_with_custom_port():
    'the harvest command should take a --port argument'

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

    import tornado.ioloop
    import tornado.web

    class MainHandler(tornado.web.RequestHandler):
        def get(self):
            self.write("Hello, world")
            raise SystemExit()

    def runserver():
        application = tornado.web.Application([
            (r"/", MainHandler),
        ])
        application.listen(9889)
        tornado.ioloop.IOLoop.instance().start()

    server = multiprocessing.Process(target=runserver)
    server.start()
    time.sleep(1)  # the child process take some time to get up

    e = 'Lettuce could not run the builtin Django server at 0.0.0.0:9889"\n' \
        'maybe you forgot a "runserver" instance running ?\n\n' \
        'well if you really do not want lettuce to run the server ' \
        'for you, then just run:\n\n' \
        'python manage.py --no-server'

    try:
        status, out = commands.getstatusoutput(
            "python manage.py harvest --verbosity=3 --port=9889")
        assert_equals(out, e)
        assert_not_equals(status, 0)

    finally:
        os.kill(server.pid, 9)
        FileSystem.popd()
Exemple #10
0
def test_django_background_server_running_in_background():
    'the django builtin server fails if the HTTP port is not available'

    import tornado.ioloop
    import tornado.web

    class MainHandler(tornado.web.RequestHandler):
        def get(self):
            self.write("Hello, world")
            raise SystemExit()

    def runserver():
        application = tornado.web.Application([
            (r"/", MainHandler),
        ])
        application.listen(8000)
        tornado.ioloop.IOLoop.instance().start()

    server = multiprocessing.Process(target=runserver)
    server.start()
    time.sleep(1)  # the child process take some time to get up

    e = 'Lettuce could not run the builtin Django server at 0.0.0.0:8000"\n' \
        'maybe you forgot a "runserver" instance running ?\n\n' \
        'well if you really do not want lettuce to run the server ' \
        'for you, then just run:\n\n' \
        'python manage.py --no-server'

    try:
        status, out = commands.getstatusoutput(
            "python manage.py harvest --verbosity=3 --no-color")
        assert_equals(out, e)
        assert_not_equals(status, 0)

    finally:
        os.kill(server.pid, 9)
Exemple #11
0
def test_django_background_server_running_in_background():
    'the django builtin server fails if the HTTP port is not available'

    import tornado.ioloop
    import tornado.web

    class MainHandler(tornado.web.RequestHandler):
        def get(self):
            self.write("Hello, world")
            raise SystemExit()

    def runserver():
        application = tornado.web.Application([
            (r"/", MainHandler),
        ])
        application.listen(8000)
        tornado.ioloop.IOLoop.instance().start()

    server = multiprocessing.Process(target=runserver)
    server.start()
    time.sleep(1)  # the child process take some time to get up

    e = 'Lettuce could not run the builtin Django server at 0.0.0.0:8000"\n' \
        'maybe you forgot a "runserver" instance running ?\n\n' \
        'well if you really do not want lettuce to run the server ' \
        'for you, then just run:\n\n' \
        'python manage.py --no-server'

    try:
        status, out = commands.getstatusoutput(
            "python manage.py harvest --verbosity=3")
        assert_equals(out, e)
        assert_not_equals(status, 0)

    finally:
        os.kill(server.pid, 9)