def test_session_sticky(self): inp_data = nginx.loads(TESTBLOCK_CASE_7) out_data = '\n' + nginx.dumps(inp_data) self.assertEqual(TESTBLOCK_CASE_7, out_data)
def test_complex_upstream(self): inp_data = nginx.loads(TESTBLOCK_CASE_6) out_data = '\n' + nginx.dumps(inp_data) self.assertEqual(TESTBLOCK_CASE_6, out_data)
def test_quoted_key_value(self): data = nginx.loads(TESTBLOCK_CASE_5) out_data = '\n' + nginx.dumps(data) self.assertEqual(out_data, TESTBLOCK_CASE_5)
def test_reflection(self): inp_data = nginx.loads(TESTBLOCK_CASE_1) out_data = '\n' + nginx.dumps(inp_data) self.assertEqual(TESTBLOCK_CASE_1, out_data)
if not url: print "ERROR: Environment variable %s does not exist, exiting..." % env_var sys.exit(1) upstream_args.append(nginx.Key('server', url)) u = nginx.Upstream(*upstream_args) c.add(u) s = nginx.Server() s.add( nginx.Key('listen', '80'), nginx.Comment( 'Autogenerated configuration from build_config_run_nginx.py'), nginx.Key('server_name', 'localhost'), nginx.Key('root', '/usr/share/nginx/html'), nginx.Key('index', 'index.html'), nginx.Location('/', nginx.Key('proxy_pass', 'http://tasks'))) c.add(s) print nginx.dumps(c) nginx.dumpf(c, '/etc/nginx/conf.d/default.conf') nginx = subprocess.Popen(["nginx", "-g", "daemon off;"], stderr=subprocess.PIPE, stdout=subprocess.PIPE) print nginx.communicate()
def test_reflection(self): inp_data = nginx.loads(TESTBLOCK) out_data = '\n' + nginx.dumps(inp_data) self.assertEqual(TESTBLOCK, out_data)