-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AMQP] Fix Filter Set Encoding For 2 Char Length Session id (#32860)
* fix for len 2 string * fix for char length * fix pylint * fix to keep the right data value * pylint * switch order * raise error * encode unit tests * get behavior in line with uamqp * modified to add any value * narrow exception * live test * changelog
- Loading branch information
1 parent
1568f5f
commit 09f0ab0
Showing
5 changed files
with
72 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
sdk/eventhub/azure-eventhub/tests/pyamqp_tests/unittest/test_encode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pytest | ||
from azure.eventhub._pyamqp._encode import encode_filter_set | ||
|
||
@pytest.mark.parametrize("value,expected", [ | ||
({b'com.microsoft:session-filter': 'ababa'}, 'ababa'), | ||
({b'com.microsoft:session-filter': 'abab'}, 'abab'), | ||
({b'com.microsoft:session-filter': 'aba'}, 'aba'), | ||
({b'com.microsoft:session-filter': 'ab'}, 'ab'), | ||
({b'com.microsoft:session-filter': 'a'}, 'a'), | ||
({b'com.microsoft:session-filter': 1}, 1), | ||
]) | ||
def test_valid_filter_encode(value, expected): | ||
fields = encode_filter_set(value) | ||
assert len(fields) == 2 | ||
assert fields['VALUE'][0][1] == expected | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters