diff --git a/azure/functions/decorators/function_app.py b/azure/functions/decorators/function_app.py index a7160870..f2af63e7 100644 --- a/azure/functions/decorators/function_app.py +++ b/azure/functions/decorators/function_app.py @@ -3313,7 +3313,13 @@ class Blueprint(TriggerApi, BindingApi, SettingsApi): pass -class ExternalHttpFunctionApp(FunctionRegister, TriggerApi, ABC): +class ExternalHttpFunctionApp( + FunctionRegister, + TriggerApi, + SettingsApi, + BindingApi, + ABC +): """Interface to extend for building third party http function apps.""" @abc.abstractmethod diff --git a/tests/decorators/test_function_app.py b/tests/decorators/test_function_app.py index 2f687262..c85b5dfd 100644 --- a/tests/decorators/test_function_app.py +++ b/tests/decorators/test_function_app.py @@ -1,5 +1,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from abc import ABC import inspect import json import unittest @@ -11,10 +12,12 @@ TIMER_TRIGGER from azure.functions.decorators.core import DataType, AuthLevel, \ BindingDirection, SCRIPT_FILE_NAME -from azure.functions.decorators.function_app import BindingApi, \ - FunctionBuilder, FunctionApp, Function, Blueprint, DecoratorApi, \ - AsgiFunctionApp, WsgiFunctionApp, HttpFunctionsAuthLevelMixin, \ - FunctionRegister, TriggerApi, ExternalHttpFunctionApp +from azure.functions.decorators.function_app import ( + BindingApi, FunctionBuilder, FunctionApp, Function, Blueprint, + DecoratorApi, AsgiFunctionApp, SettingsApi, WsgiFunctionApp, + HttpFunctionsAuthLevelMixin, FunctionRegister, TriggerApi, + ExternalHttpFunctionApp +) from azure.functions.decorators.http import HttpTrigger, HttpOutput, \ HttpMethod from azure.functions.decorators.retry_policy import RetryPolicy @@ -322,6 +325,15 @@ def test_add_wsgi(self, add_http_app_mock): self.assertIsInstance(add_http_app_mock.call_args[0][0], WsgiMiddleware) + def test_extends_required_classes(self): + self.assertTrue(issubclass(ExternalHttpFunctionApp, FunctionRegister)) + self.assertTrue(issubclass(ExternalHttpFunctionApp, TriggerApi)) + self.assertTrue(issubclass(ExternalHttpFunctionApp, SettingsApi)) + self.assertTrue(issubclass(ExternalHttpFunctionApp, BindingApi)) + self.assertTrue(issubclass(ExternalHttpFunctionApp, ABC)) + self.assertTrue(issubclass(AsgiFunctionApp, ExternalHttpFunctionApp)) + self.assertTrue(issubclass(WsgiFunctionApp, ExternalHttpFunctionApp)) + def test_add_asgi_app(self): self._test_http_external_app(AsgiFunctionApp(app=object()), True) diff --git a/tests/test_http.py b/tests/test_http.py index f6dfab07..1efa82bd 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -181,9 +181,10 @@ def test_http_response_does_not_have_explicit_output(self): def test_http_response_accepts_http_enums(self): response = func.HttpResponse(status_code=404) - self.assertEquals(response.status_code, 404) + self.assertEqual(response.status_code, 404) + response = func.HttpResponse(status_code=HTTPStatus.ACCEPTED) - self.assertEquals(response.status_code, 202) + self.assertEqual(response.status_code, HTTPStatus.ACCEPTED.value) def test_http_request_converter_decode(self): data = {