forked from Defiance-Digital/kubectl-provider
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Momnt-Technologies/aray-finalFix
fix: fixing the loggers to handle both types of json outputs
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from index import parse_json | ||
|
||
def test_parse_json(): | ||
json_str = '{"key": "value"}' | ||
assert parse_json(json_str) == {"key": "value"} | ||
print("base case assert passed") | ||
|
||
json_str = '{"key": "value"}\n{"key": "value"}' | ||
assert parse_json(json_str) == [{"key": "value"}, {"key": "value"}] | ||
print("multiple logs in one message assert passed") | ||
|
||
json_str = '{"key": "value"}\n{"key": "value"' | ||
assert parse_json(json_str) == [{"key": "value"}] | ||
print("incomplete log assert passed") | ||
|
||
json_str = '{"key": "value"}\n{"key": "value"}\n{"key": "value"}' | ||
assert parse_json(json_str) == [{"key": "value"}, {"key": "value"}, {"key": "value"}] | ||
print("more than 2 logs assert passed") | ||
|
||
if __name__ == "__main__": | ||
test_parse_json() |