Skip to content

Commit

Permalink
Python worker version 1.0.4 (#621)
Browse files Browse the repository at this point in the history
* Python worker version 1.0.4

* Update eventhub testcases
  • Loading branch information
Hazhzeng authored Feb 20, 2020
1 parent 15557a1 commit 443f412
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def run(self):

setup(
name='azure-functions-worker',
version='1.0.3',
version='1.0.4',
description='Python Language Worker for Azure Functions Host',
classifiers=[
'License :: OSI Approved :: MIT License',
Expand All @@ -278,7 +278,7 @@ def run(self):
],
extras_require={
'dev': [
'azure-functions==1.0.8',
'azure-functions==1.1.0',
'flake8~=3.7.9',
'mypy',
'pytest',
Expand Down
43 changes: 29 additions & 14 deletions tests/unittests/test_mock_eventhub_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,22 @@ async def call_and_check():
),
],
metadata={
'iothub-device-id': protos.TypedData(
string='mock-iothub-device-id'
),
'iothub-auth-data': protos.TypedData(
string='mock-iothub-auth-data'
)
'SystemProperties': protos.TypedData(json=json.dumps({
'iothub-device-id': 'mock-iothub-device-id',
'iothub-auth-data': 'mock-iothub-auth-data',
'EnqueuedTimeUtc': '2020-02-18T21:28:42.5888539Z'
}))
}
)

self.assertEqual(r.response.result.status,
protos.StatusResult.Success)
self.assertIn(
'mock-iothub-device-id',
r.response.return_value.string
)

res_json_string = r.response.return_value.string
self.assertIn('device-id', res_json_string)
self.assertIn('mock-iothub-device-id', res_json_string)
self.assertIn('auth-data', res_json_string)
self.assertIn('mock-iothub-auth-data', res_json_string)

await call_and_check()

Expand All @@ -70,7 +71,13 @@ async def test_mock_eventhub_cardinality_one(self):
),
),
],
metadata={}
metadata={
'SystemProperties': protos.TypedData(json=json.dumps({
'iothub-device-id': 'mock-iothub-device-id',
'iothub-auth-data': 'mock-iothub-auth-data',
'EnqueuedTimeUtc': '2020-02-18T21:28:42.5888539Z'
}))
}
)

self.assertEqual(r.response.result.status,
Expand Down Expand Up @@ -104,13 +111,21 @@ async def test_mock_eventhub_cardinality_many(self):
protos.ParameterBinding(
name='events',
data=protos.TypedData(
json=json.dumps({
json=json.dumps([{
'id': 'cardinality_many'
})
}])
),
),
],
metadata={}
metadata={
'SystemPropertiesArray': protos.TypedData(json=json.dumps([
{
'iothub-device-id': 'mock-iothub-device-id',
'iothub-auth-data': 'mock-iothub-auth-data',
'EnqueuedTimeUtc': '2020-02-18T21:28:42.5888539Z'
}
]))
}
)

self.assertEqual(r.response.result.status,
Expand Down

0 comments on commit 443f412

Please sign in to comment.