Esempio n. 1
0
    def test_create_health_check_fqdn(self):
        self.set_http_response(status_code=201)
        hc = HealthCheck(ip_addr='', port=443, hc_type='HTTPS', resource_path='/health_check', fqdn='example.com')
        hc_xml = hc.to_xml()
        self.assertTrue('<FullyQualifiedDomainName>' in hc_xml)
        self.assertFalse('<IPAddress>' in hc_xml)

        response = self.service_connection.create_health_check(hc)
        hc_resp = response['CreateHealthCheckResponse']['HealthCheck']['HealthCheckConfig']
        self.assertEqual(hc_resp['FullyQualifiedDomainName'], 'example.com')
        self.assertEqual(hc_resp['ResourcePath'], '/health_check')
        self.assertEqual(hc_resp['Type'], 'HTTPS')
        self.assertEqual(hc_resp['Port'], '443')
        self.assertEqual(hc_resp['ResourcePath'], '/health_check')
        self.assertEqual(response['CreateHealthCheckResponse']['HealthCheck']['Id'], 'f9abfe10-8d2a-4bbd-8f35-796f0f8572f2')
    def test_create_health_check_fqdn(self):
        self.set_http_response(status_code=201)
        hc = HealthCheck(ip_addr='', port=443, hc_type='HTTPS', resource_path='/health_check', fqdn='example.com')
        hc_xml = hc.to_xml()
        self.assertTrue('<FullyQualifiedDomainName>' in hc_xml)
        self.assertFalse('<IPAddress>' in hc_xml)

        response = self.service_connection.create_health_check(hc)
        hc_resp = response['CreateHealthCheckResponse']['HealthCheck']['HealthCheckConfig']
        self.assertEqual(hc_resp['FullyQualifiedDomainName'], 'example.com')
        self.assertEqual(hc_resp['ResourcePath'], '/health_check')
        self.assertEqual(hc_resp['Type'], 'HTTPS')
        self.assertEqual(hc_resp['Port'], '443')
        self.assertEqual(hc_resp['ResourcePath'], '/health_check')
        self.assertEqual(response['CreateHealthCheckResponse']['HealthCheck']['Id'], 'f9abfe10-8d2a-4bbd-8f35-796f0f8572f2')
Esempio n. 3
0
    def test_create_health_check_ip_address(self):
        self.set_http_response(status_code=201)
        hc = HealthCheck(ip_addr='74.125.228.81', port=443, hc_type='HTTPS_STR_MATCH', resource_path='/health_check', string_match='OK')
        hc_xml = hc.to_xml()
        self.assertFalse('<FullyQualifiedDomainName>' in hc_xml)
        self.assertTrue('<IPAddress>' in hc_xml)

        response = self.service_connection.create_health_check(hc)
        hc_resp = response['CreateHealthCheckResponse']['HealthCheck']['HealthCheckConfig']
        self.assertEqual(hc_resp['IPAddress'], '74.125.228.81')
        self.assertEqual(hc_resp['ResourcePath'], '/health_check')
        self.assertEqual(hc_resp['Type'], 'HTTPS_STR_MATCH')
        self.assertEqual(hc_resp['Port'], '443')
        self.assertEqual(hc_resp['ResourcePath'], '/health_check')
        self.assertEqual(hc_resp['SearchString'], 'OK')
        self.assertEqual(response['CreateHealthCheckResponse']['HealthCheck']['Id'], '34778cf8-e31e-4974-bad0-b108bd1623d3')
    def test_create_health_check_ip_address(self):
        self.set_http_response(status_code=201)
        hc = HealthCheck(ip_addr='74.125.228.81', port=443, hc_type='HTTPS_STR_MATCH', resource_path='/health_check', string_match='OK')
        hc_xml = hc.to_xml()
        self.assertFalse('<FullyQualifiedDomainName>' in hc_xml)
        self.assertTrue('<IPAddress>' in hc_xml)

        response = self.service_connection.create_health_check(hc)
        hc_resp = response['CreateHealthCheckResponse']['HealthCheck']['HealthCheckConfig']
        self.assertEqual(hc_resp['IPAddress'], '74.125.228.81')
        self.assertEqual(hc_resp['ResourcePath'], '/health_check')
        self.assertEqual(hc_resp['Type'], 'HTTPS_STR_MATCH')
        self.assertEqual(hc_resp['Port'], '443')
        self.assertEqual(hc_resp['ResourcePath'], '/health_check')
        self.assertEqual(hc_resp['SearchString'], 'OK')
        self.assertEqual(response['CreateHealthCheckResponse']['HealthCheck']['Id'], '34778cf8-e31e-4974-bad0-b108bd1623d3')