def test_proxy_remote(self): result = list(nginx.extract_sites(self.multiple_example)) pprint(result) specific_site = [ site for site in result if site["name"] == "api.ddsc.nl" ][0] self.assertEqual(specific_site["proxy_to_other_server"], "110-haprox-d2.ourdomain")
def test_redirect_protocol(self): result = list(nginx.extract_sites(self.redirect_example)) pprint(result) self.assertEqual(result[0]["redirect_to_protocol"], "https")
def test_redirect_target(self): result = list(nginx.extract_sites(self.redirect_example)) pprint(result) self.assertEqual(result[0]["redirect_to"], "uploadservice.lizard.net")
def test_redirect_count(self): result = list(nginx.extract_sites(self.redirect_example)) pprint(result) self.assertEqual(len(result), 1)
def test_proxy_local(self): result = list(nginx.extract_sites(self.single_example)) pprint(result) self.assertEqual(result[0]["proxy_to_local_port"], "9070")
def test_protocol_https(self): result = list(nginx.extract_sites(self.multiple_example)) pprint(result) self.assertEqual(result[0]["protocol"], "https")
def test_regex_count(self): # Weird lizard5-only regex magic. result = list(nginx.extract_sites(self.regex_example)) pprint(result) self.assertEqual(len(result), 3)
def test_multiple_count(self): # Two server parts, one with a double name. result = list(nginx.extract_sites(self.multiple_example)) pprint(result) self.assertEqual(len(result), 3)