def test_start_with_nginx(popen):
    popen.return_value.pid = -1
    calls = [
        call(["nginx", "-c", "/tmp/nginx.conf"]),
        call([
            "gunicorn",
            "--timeout",
            "100",
            "-k",
            "gevent",
            "--pythonpath",
            "/opt/folder,/lib/another/folder,%s" % _env.code_dir,
            "-b",
            "unix:/tmp/gunicorn.sock",
            "--worker-connections",
            "2000",
            "-w",
            "2",
            "--log-level",
            "info",
            "my_module",
        ]),
    ]
    _server.start("my_module")
    popen.assert_has_calls(calls)
def test_start_with_nginx(popen):
    calls = [
        call(['nginx', '-c', '/tmp/nginx.conf']),
        call([
            'gunicorn', '--timeout', '100', '-k', 'gevent', '-b',
            'unix:/tmp/gunicorn.sock', '--worker-connections', '2000', '-w',
            '2', '--log-level', 'info', 'my_module'
        ])
    ]
    _server.start('my_module')
    popen.assert_has_calls(calls)
def test_start_no_nginx(popen):
    calls = [
        call([
            'gunicorn', '--timeout', '100', '-k', 'gevent', '-b',
            '0.0.0.0:8080', '--worker-connections', '2000', '-w', '2',
            '--log-level', 'info', 'my_module'
        ])
    ]

    _server.start('my_module')
    popen.assert_has_calls(calls)
def test_start_no_nginx(popen):
    popen.return_value.pid = -1
    calls = [call(
        ['gunicorn',
         '--timeout', '100',
         '-k', 'gevent',
         '--pythonpath', '/opt/folder,/lib/another/folder,%s' % _env.code_dir,
         '-b', '0.0.0.0:8080',
         '--worker-connections', '2000',
         '-w', '2',
         '--log-level', 'info',
         'my_module'])]

    _server.start('my_module')
    popen.assert_has_calls(calls)