def step_update_service_parameters(self, client_id):
     with XRDSSTTest() as app:
         service_controller = ServiceController()
         description = get_service_description(self.config, client_id)
         assert description["services"][0]["timeout"] == 60
         assert description["services"][0][
             "url"] == 'http://petstore.swagger.io/v1'
         service_controller.app = app
         service_controller.load_config = (lambda: self.config)
         service_controller.update_parameters()
         description = get_service_description(self.config, client_id)
         assert description["services"][0]["timeout"] == 120
         assert description["services"][0]["url"] == 'http://petstore.xxx'
 def step_update_service_parameters(self, client_id):
     service_controller = ServiceController()
     description = get_service_description(self.config, client_id)
     assert description["services"][0]["timeout"] == 60
     assert description["services"][0]["url"] == 'http://petstore.swagger.io/v1'
     for security_server in self.config["security_server"]:
         configuration = service_controller.create_api_config(security_server, self.config)
         for client in security_server["clients"]:
             if "service_descriptions" in client:
                 for service_description in client["service_descriptions"]:
                     service_controller.remote_update_service_parameters(configuration, security_server, client, service_description)
     description = get_service_description(self.config, client_id)
     assert description["services"][0]["timeout"] == 120
     assert description["services"][0]["url"] == 'http://petstore.xxx'
 def step_enable_service_description(self, client_id):
     with XRDSSTTest() as app:
         service_controller = ServiceController()
         service_controller.app = app
         service_controller.load_config = (lambda: self.config)
         service_controller.enable_description()
         service_description = get_service_description(
             self.config, client_id)
         assert service_description["disabled"] is False
 def step_add_endpoints_access(self, client_id):
     with XRDSSTTest() as app:
         endpoint_controller = EndpointController()
         endpoint_controller.app = app
         endpoint_controller.load_config = (lambda: self.config)
         endpoint_controller.add_access()
         description = get_service_description(self.config, client_id)
         service_clients = get_endpoint_service_clients(
             self.config, description["services"][0]["endpoints"][4]["id"])
         assert len(service_clients) == 1
 def step_enable_service_description(self, client_id):
     service_controller = ServiceController()
     for security_server in self.config["security_server"]:
         configuration = service_controller.create_api_config(security_server, self.config)
         for client in security_server["clients"]:
             if 'service_descriptions' in client:
                 for service_description in client["service_descriptions"]:
                     service_controller.remote_enable_service_description(configuration, security_server, client, service_description)
     description = get_service_description(self.config, client_id)
     assert description["disabled"] is False
 def step_add_service_access(self, client_id):
     service_controller = ServiceController()
     for security_server in self.config["security_server"]:
         configuration = service_controller.create_api_config(security_server, self.config)
         for client in security_server["clients"]:
             if 'service_descriptions' in client:
                 for service_description in client["service_descriptions"]:
                     service_controller.remote_add_access_rights(configuration, security_server, client, service_description)
     description = get_service_description(self.config, client_id)
     service_clients = get_service_clients(self.config, description["services"][0]["id"])
     assert len(service_clients) == 1
 def step_add_service_endpoints(self, client_id):
     with XRDSSTTest() as app:
         endpoint_controller = EndpointController()
         endpoint_controller.app = app
         endpoint_controller.load_config = (lambda: self.config)
         endpoint_controller.add()
         description = get_service_description(self.config, client_id)
         assert len(description["services"][0]["endpoints"]) == 5
         assert str(description["services"][0]["endpoints"][4]
                    ["path"]) == "/testPath"
         assert str(
             description["services"][0]["endpoints"][4]["method"]) == "POST"
    def step_add_endpoints_access(self, client_id):
        endpoint_controller = EndpointController()
        for security_server in self.config["security_server"]:
            configuration = endpoint_controller.create_api_config(security_server, self.config)
            for client in security_server["clients"]:
                if "service_descriptions" in client:
                    for service_description in client["service_descriptions"]:
                        endpoint_controller.remote_add_endpoints_access(configuration, service_description, client, service_description)

        description = get_service_description(self.config, client_id)
        service_clients = get_endpoint_service_clients(self.config, description["services"][0]["endpoints"][4]["id"])
        assert len(service_clients) == 1
        assert str(service_clients[0]["id"]) == "DEV:security-server-owners"
    def step_add_service_endpoints(self, client_id):
        endpoint_controller = EndpointController()
        for security_server in self.config["security_server"]:
            configuration = endpoint_controller.create_api_config(security_server, self.config)
            for client in security_server["clients"]:
                if "service_descriptions" in client:
                    for service_description in client["service_descriptions"]:
                        if "endpoints" in service_description:
                            for endpoint in service_description["endpoints"]:
                                endpoint_controller.remote_add_service_endpoints(configuration, security_server, client, service_description, endpoint)

        description = get_service_description(self.config, client_id)
        assert len(description["services"][0]["endpoints"]) == 5
        assert str(description["services"][0]["endpoints"][4]["path"]) == "/testPath"
        assert str(description["services"][0]["endpoints"][4]["method"]) == "POST"