Skip to content

Commit 17a69f5

Browse files
authored
Add unittests for generic bindings and durable functions (#624)
* Add unittests for generic bindings * Add a case for testing no annotation scenarios * Fix generic binding without datatype test
1 parent 0fccf5a commit 17a69f5

File tree

16 files changed

+304
-0
lines changed

16 files changed

+304
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"scriptFile": "main.py",
3+
"bindings": [
4+
{
5+
"type": "activityTrigger",
6+
"name": "input",
7+
"direction": "in"
8+
}
9+
]
10+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def main(input: str) -> str:
2+
return input
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"scriptFile": "main.py",
3+
"bindings": [
4+
{
5+
"type": "activityTrigger",
6+
"name": "input",
7+
"direction": "in"
8+
}
9+
]
10+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def main(input):
2+
return input
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"scriptFile": "main.py",
3+
"bindings": [
4+
{
5+
"type": "orchestrationTrigger",
6+
"name": "context",
7+
"direction": "in"
8+
}
9+
]
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# import azure.durable_functions as df
2+
3+
4+
def generator_function(context):
5+
final_result = yield context.call_activity('activity_trigger', 'foobar')
6+
return final_result
7+
8+
9+
def main(context):
10+
# orchestrate = df.Orchestrator.create(generator_function)
11+
# result = orchestrate(context)
12+
# return result
13+
return f'{context} :)'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"scriptFile": "main.py",
3+
"bindings": [
4+
{
5+
"type": "foobar",
6+
"name": "input",
7+
"direction": "in",
8+
"dataType": "binary"
9+
},
10+
{
11+
"direction": "out",
12+
"name": "$return",
13+
"type": "foobar",
14+
"dataType": "binary"
15+
}
16+
]
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Input as bytes, without annotation
2+
def main(input):
3+
return input
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"scriptFile": "main.py",
3+
"bindings": [
4+
{
5+
"type": "foobar",
6+
"name": "input",
7+
"direction": "in",
8+
"dataType": "string"
9+
},
10+
{
11+
"direction": "out",
12+
"name": "$return",
13+
"type": "foobar",
14+
"dataType": "string"
15+
}
16+
]
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Input as string, without annotation
2+
def main(input):
3+
return input

0 commit comments

Comments
 (0)