2

I have an airflow instance, and created some flask APIs as plugins. I am wondering if there is any way I can run some unittests for these APIs without them being dependent on Airflow?

from flask_appbuilder.api import BaseApi, expose
from flask import send_file, request

class SomeApi(BaseApi):
    route_base = "/api/v1/someapi/"

    @expose("/upload/<path:path>", methods=["POST"])
    def upload_file(self, path: str):
        file = request.files["file"]
        config = self.api_config()
        .
        .
        return self.response(201, path=target_file_path, message=None)

some_api_nomenu_view = SomeApi()
some_api_nomenu_package = {"view": some_api_nomenu_view}

class SomeApiPlugin(AirflowPlugin):
    name = "some_api_name"
    appbuilder_views = [some_api_nomenu_package]

How could you test in this case the upload_file for example? Any help on this is much appreciated, I am new to flask.

Zselter07
  • 71
  • 5

0 Answers0