Skip to content

Commit 751943f

Browse files
committed
added V2 test
1 parent 0f5b223 commit 751943f

File tree

6 files changed

+52
-9
lines changed

6 files changed

+52
-9
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
import azure.functions as func
4+
5+
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)
6+
7+
8+
@app.function_name(name="return_processed_last")
9+
@app.generic_trigger(arg_name="req", type="httpTrigger",
10+
route="return_processed_last")
11+
@app.generic_output_binding(arg_name="$return", type="http")
12+
@app.generic_input_binding(
13+
arg_name="testEntity",
14+
type="table",
15+
connection="AzureWebJobsStorage",
16+
table_name="EventHubBatchTest")
17+
def return_processed_last(req: func.HttpRequest, testEntity):
18+
return func.HttpResponse(status_code=200)
19+
20+
21+
@app.function_name(name="return_not_processed_last")
22+
@app.generic_trigger(arg_name="req", type="httpTrigger",
23+
route="return_not_processed_last")
24+
@app.generic_output_binding(arg_name="$return", type="http")
25+
@app.generic_input_binding(
26+
arg_name="testEntities",
27+
type="table",
28+
connection="AzureWebJobsStorage",
29+
table_name="EventHubBatchTest")
30+
def return_not_processed_last(req: func.HttpRequest, testEntities):
31+
return func.HttpResponse(status_code=200)

tests/endtoend/generic_functions/return_not_processed_last/__init__.py

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

66
# There are 3 bindings defined in function.json:
77
# 1. req: HTTP trigger
8-
# 2. testEntity: table input (generic)
8+
# 2. testEntities: table input (generic)
99
# 3. $return: HTTP response
1010
# The bindings will be processed by the worker in this order:
11-
# req -> testEntity -> $return
12-
def main(req: func.HttpRequest, testEntity):
11+
# req -> $return -> testEntities
12+
def main(req: func.HttpRequest, testEntities):
1313
return func.HttpResponse(status_code=200)

tests/endtoend/generic_functions/return_not_processed_last/function.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{
1414
"direction": "in",
1515
"type": "table",
16-
"name": "testEntity",
16+
"name": "testEntities",
1717
"tableName": "EventHubBatchTest",
1818
"connection": "AzureWebJobsStorage"
1919
},

tests/endtoend/generic_functions/return_processed_last/__init__.py

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

66
# There are 3 bindings defined in function.json:
77
# 1. req: HTTP trigger
8-
# 2. testEntities: table input (generic)
8+
# 2. testEntity: table input (generic)
99
# 3. $return: HTTP response
1010
# The bindings will be processed by the worker in this order:
11-
# req -> $return -> testEntities
12-
def main(req: func.HttpRequest, testEntities):
11+
# req -> testEntity -> $return
12+
def main(req: func.HttpRequest, testEntity):
1313
return func.HttpResponse(status_code=200)

tests/endtoend/generic_functions/return_processed_last/function.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{
1414
"direction": "in",
1515
"type": "table",
16-
"name": "testEntities",
16+
"name": "testEntity",
1717
"tableName": "EventHubBatchTest",
1818
"connection": "AzureWebJobsStorage"
1919
},

tests/endtoend/test_generic_functions.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"Table functions which are used in the bindings in these tests"
1313
" has a bug with the table extension 1.0.0. "
1414
"https://github.com/Azure/azure-sdk-for-net/issues/33902.")
15-
class GenericFunctions(testutils.WebHostTestCase):
15+
class TestGenericFunctions(testutils.WebHostTestCase):
1616
"""Test Generic Functions with implicit output enabled
1717
1818
With implicit output enabled for generic types, these tests cover
@@ -40,3 +40,15 @@ def test_return_not_processed_last(self):
4040

4141
r = self.webhost.request('GET', 'return_not_processed_last')
4242
self.assertEqual(r.status_code, 200)
43+
44+
45+
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
46+
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
47+
"Table functions has a bug with the table extension 1.0.0."
48+
"https://github.com/Azure/azure-sdk-for-net/issues/33902.")
49+
class TestGenericFunctionsStein(TestGenericFunctions):
50+
51+
@classmethod
52+
def get_script_dir(cls):
53+
return testutils.E2E_TESTS_FOLDER / 'generic_functions' / \
54+
'generic_functions_stein'

0 commit comments

Comments
 (0)