예제 #1
0
 def test_setup_lambda_route(self):
     name        = 'api-key-generator-for-shopify'
     lambda_name = 'gw_bot_lambdas_gw_store_create_api_gw_api_key'
     rest_api    = Rest_API(name).create()
     rest_api.add_method_lambda('/','GET',lambda_name)
     rest_api.deploy()
     self.result = rest_api.test_method('/','GET')
예제 #2
0
 def test_method_invoke_test(self):
     rest_api = Rest_API('temp_rest_api').create()
     api_id = rest_api.id()
     resource_id = rest_api.resource_id('/')
     method = 'GET'
     self.result = self.api_gateway.method_invoke_test(
         api_id, resource_id, method)
예제 #3
0
 def test_method_response(self):
     rest_api = Rest_API('temp_rest_api').create()
     api_id = rest_api.id()
     resource_id = rest_api.resource_id('/')
     method = 'GET'
     status_code = '200'
     self.result = self.api_gateway.method_response(api_id, resource_id,
                                                    method, status_code)
예제 #4
0
 def test_method_response_create(self):
     rest_api = Rest_API('temp_rest_api').create()
     api_id = rest_api.id()
     resource_id = rest_api.resource_id('/')
     http_method = 'GET'
     status_code = '200'
     response_models = {'application/json': 'Empty'}
     self.result = self.api_gateway.method_response_create(
         api_id, resource_id, http_method, status_code, response_models)
예제 #5
0
 def test_integration_response_create(self):
     rest_api = Rest_API('temp_rest_api').create()
     api_id = rest_api.id()
     resource_id = rest_api.resource_id('/')
     method = 'GET'
     status_code = '200'
     response_templates = {'application/json': ''}
     self.result = self.api_gateway.integration_response_create(
         api_id, resource_id, method, status_code, response_templates)
예제 #6
0
    def test_deploy_api(self):
        rest_api = Rest_API(self.api_name).create()
        self.result = rest_api.deploy()

    # here is the test that added the A record for both top level domain and child domains
    # def test_record_set_upsert(self):
    #
    #     name                = 'gw-proxy.com.'
    #     record_type         = 'A'
    #     dns_name            = 'd-noho75bpih.execute-api.eu-west-1.amazonaws.com.'
    #     hosted_zone_id      = '/hostedzone/ZMHOWKWA1ZN69'
    #     alias_hosted_zone_id = 'ZLY8HYME6SFDD'
    #     self.result = Route_53().record_set_upsert(name, record_type, dns_name,hosted_zone_id,alias_hosted_zone_id)
    #
    # def test_record_set_upsert(self):
    #     from osbot_aws.apis.Route_53 import Route_53
    #     name                = '*.gw-proxy.com.'
    #     record_type         = 'A'
    #     dns_name            = 'd-noho75bpih.execute-api.eu-west-1.amazonaws.com.'
    #     hosted_zone_id      = '/hostedzone/ZMHOWKWA1ZN69'
    #     alias_hosted_zone_id = 'ZLY8HYME6SFDD'
    #     self.result = Route_53().record_set_upsert(name, record_type, dns_name,hosted_zone_id,alias_hosted_zone_id)
    #
    # # here is the test that asked for the wildcart Cert to be created
    # def test_certificate_request(self):
    #     #self.result = self.acm.certificate_request('*.gw-proxy.com')
    #     self.result = self.acm.certificate('arn:aws:acm:eu-west-1:311800962295:certificate/1f191c3a-0214-4ef5-9f03-27cc0b46bef3')
    #
    # def test_GET_request(self):
    #     self.result = GET(Rest_API(self.api_name).url())
    #
    # # adding domain to API Gateway
    # # gw-proxy.com
    # def test_domain_name_add_path_mapping(self):
    #     rest_api_id = self.api_gateway.rest_api_id('lambda-proxy')
    #     domain_name = 'gw-proxy.com'
    #     base_path   = ''
    #     self.result = self.api_gateway.domain_name_add_path_mapping(rest_api_id=rest_api_id,domain_name=domain_name,base_path=base_path)
    #
    # def test_domain_name_create(self):
    #     domain_name     = 'gw-proxy.com'
    #     certificate_arn = 'arn:aws:acm:eu-west-1:311800962295:certificate/cac6ccbe-e5a6-41b1-ab87-461ff1d88458'
    #     self.result     = self.api_gateway.domain_name_create__regional(domain_name=domain_name, certificate_arn=certificate_arn)
    #
    # # *.gw-proxy.com
    #
    # def test_domain_name_create(self):
    #     domain_name     = '*.gw-proxy.com'
    #     certificate_arn = 'arn:aws:acm:eu-west-1:311800962295:certificate/be75edef-b698-4425-bf7a-7a129bb0331e'
    #     self.result     = self.api_gateway.domain_name_create__regional(domain_name=domain_name, certificate_arn=certificate_arn)
    #
    # def test_domain_name_add_path_mapping(self):
    #     rest_api_id = self.api_gateway.rest_api_id('lambda-proxy')
    #     domain_name = '*.gw-proxy.com'
    #     base_path   = ''
    #     self.result = self.api_gateway.domain_name_add_path_mapping(rest_api_id=rest_api_id,domain_name=domain_name,base_path=base_path)
예제 #7
0
 def test_setup_lambda_route(self):  # will create a {proxy+} integration
     rest_api = Rest_API(self.api_name).create()
     parent_id = rest_api.resource_id('/')
     if not rest_api.api_gateway.rest_api_exists(rest_api.id()):
         rest_api.api_gateway.resource_create(
             rest_api.id(), parent_id, '{proxy+}')
     self.result = rest_api.add_method_lambda(
         '/', 'ANY', self.lambda_name)  # need to add both
     self.result = rest_api.add_method_lambda(
         '/{proxy+}', 'ANY', self.lambda_name)  # since this one wasn't catching the root requests
     rest_api.deploy()
예제 #8
0
 def test_integration_create__http(self):
     uri = 'http://httpbin.org/robots.txt'
     rest_api = Rest_API('temp_rest_api').create()
     method = 'GET'
     integration_method = 'GET'
     api_id = rest_api.id()
     resource_id = rest_api.resource_id('/')
     self.api_gateway.method_create(api_id, resource_id, method)
     self.result = self.api_gateway.integration_create__http(
         api_id=api_id,
         resource_id=resource_id,
         uri=uri,
         http_method=method,
         integration_http_method=integration_method)
예제 #9
0
 def test_deployment_create(self):
     stage = 'Test_QA'
     api_id = Rest_API('temp_rest_api').create().id()
     self.result = self.api_gateway.deployment_create(api_id, stage)
예제 #10
0
 def setUp(self):
     super().setUp()
     self.api_gateway = API_Gateway()
     self.rest_api = Rest_API('temp_rest_api').create()
     self.api_id = self.rest_api.id()
예제 #11
0
 def setUp(self):
     self.name = 'temp-unit-test-api'
     super().setUp()
     self.rest_api = Rest_API(self.name)
예제 #12
0
 def test_just_invoke(self):
     name = 'api-key-generator-for-shopify'
     self.result = Rest_API(name).test_method().get('body')
예제 #13
0
 def setUp(self):
     super().setUp()
     self.rest_api = Rest_API(self.test_rest_api_name)
예제 #14
0
 def teardown_test_enviroment__Rest_API(cls):
     rest_api = Rest_API(cls.test_rest_api_name)
     assert rest_api.delete().not_exists()
예제 #15
0
 def setup_test_enviroment__Rest_API(
         cls):  # todo: refactor into separate class
     rest_api = Rest_API(cls.test_rest_api_name)
     rest_api.create()