Skip to content

Commit 3972294

Browse files
peterstone2017YunchuWang
authored andcommitted
update asgi/wsgi stein tests
1 parent 3116e11 commit 3972294

File tree

8 files changed

+29
-489
lines changed

8 files changed

+29
-489
lines changed

azure_functions_worker/testutils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,13 @@ def __init__(self, proc, addr):
745745
def request(self, meth, funcname, *args, **kwargs):
746746
request_method = getattr(requests, meth.lower())
747747
params = dict(kwargs.pop('params', {}))
748+
no_prefix = kwargs.pop('no_prefix', False)
748749
if 'code' not in params:
749750
params['code'] = 'testFunctionKey'
750-
return request_method(self._addr + '/api/' + funcname,
751-
*args, params=params, **kwargs)
751+
752+
return request_method(
753+
self._addr + ('/' if no_prefix else '/api/') + funcname,
754+
*args, params=params, **kwargs)
752755

753756
def close(self):
754757
if self._proc.stdout:

tests/stein_tests/endtoendtests/test_third_party_http_functions.py renamed to tests/endtoend/test_third_party_http_functions.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
import requests
77

8-
from azure_functions_worker import testutils as utils
9-
from tests.stein_tests import testutils
10-
from tests.stein_tests.constants import E2E_TESTS_ROOT
8+
from azure_functions_worker import testutils as utils, testutils
9+
10+
# from tests.stein_tests import testutils
11+
# from tests.stein_tests.constants import E2E_TESTS_ROOT
12+
from azure_functions_worker.testutils import E2E_TESTS_ROOT
1113

1214
HOST_JSON_TEMPLATE = """\
1315
{
@@ -148,14 +150,16 @@ def test_raise_exception_should_return_not_found(self):
148150

149151

150152
class TestAsgiHttpFunctions(
151-
ThirdPartyHttpFunctionsTestBase.TestThirdPartyHttpFunctions):
153+
ThirdPartyHttpFunctionsTestBase.TestThirdPartyHttpFunctions):
152154
@classmethod
153155
def get_script_dir(cls):
154-
return E2E_TESTS_ROOT / 'third_party_http_functions' / 'asgi_function'
156+
return E2E_TESTS_ROOT / 'third_party_http_functions' / 'stein' / \
157+
'asgi_function'
155158

156159

157160
class TestWsgiHttpFunctions(
158-
ThirdPartyHttpFunctionsTestBase.TestThirdPartyHttpFunctions):
161+
ThirdPartyHttpFunctionsTestBase.TestThirdPartyHttpFunctions):
159162
@classmethod
160163
def get_script_dir(cls):
161-
return E2E_TESTS_ROOT / 'third_party_http_functions' / 'wsgi_function'
164+
return E2E_TESTS_ROOT / 'third_party_http_functions' / 'stein' / \
165+
'wsgi_function'

tests/stein_tests/endtoendtests/third_party_http_functions/asgi_function/function_app.py renamed to tests/endtoend/third_party_http_functions/stein/asgi_function/function_app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ async def raise_http_exception():
3737
raise HTTPException(status_code=404, detail="Item not found")
3838

3939

40-
app = func.FunctionApp(asgi_app=fast_app, auth_level=func.AuthLevel.ANONYMOUS)
40+
app = func.FunctionApp(asgi_app=fast_app,
41+
http_auth_level=func.AuthLevel.ANONYMOUS)

tests/stein_tests/endtoendtests/third_party_http_functions/wsgi_function/function_app.py renamed to tests/endtoend/third_party_http_functions/stein/wsgi_function/function_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ def raise_http_exception():
3333

3434

3535
app = func.FunctionApp(wsgi_app=flask_app.wsgi_app,
36-
auth_level=func.AuthLevel.ANONYMOUS)
36+
http_auth_level=func.AuthLevel.ANONYMOUS)

0 commit comments

Comments
 (0)