-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f4e369
commit e8254d6
Showing
2 changed files
with
75 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from base64 import b64encode | ||
from unittest import TestCase | ||
|
||
from tinyman.utils import generate_app_call_note, parse_app_call_note | ||
|
||
|
||
class BaseTestCase(TestCase): | ||
maxDiff = None | ||
|
||
def test_app_call_note(self): | ||
note = generate_app_call_note( | ||
version="v2", client_name="unit-test", extra_data={"extra": "some text"} | ||
) | ||
expected_result = { | ||
"version": "v2", | ||
"data": {"extra": "some text", "origin": "unit-test"}, | ||
} | ||
|
||
# test possible versions | ||
string_note = note | ||
bytes_note = string_note.encode() | ||
base64_note = b64encode(bytes_note).decode() | ||
|
||
result = parse_app_call_note(string_note) | ||
self.assertDictEqual( | ||
result, | ||
expected_result, | ||
) | ||
|
||
result = parse_app_call_note(base64_note) | ||
self.assertDictEqual( | ||
result, | ||
expected_result, | ||
) | ||
|
||
result = parse_app_call_note(base64_note) | ||
self.assertDictEqual( | ||
result, | ||
expected_result, | ||
) |
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