-
Notifications
You must be signed in to change notification settings - Fork 30
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
Daniel Tom
committed
Jun 16, 2024
1 parent
4e284b6
commit a01370b
Showing
6 changed files
with
44 additions
and
14 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 |
---|---|---|
|
@@ -9,4 +9,5 @@ __pycache__ | |
*.iml | ||
|
||
.coverage | ||
.python-version | ||
.python-version | ||
coverage.xml |
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import runpy | ||
from unittest.mock import MagicMock, patch | ||
|
||
from pydantic_avro import __main__ as main_module | ||
|
||
|
||
@patch("pydantic_avro.__main__.convert_file") | ||
def test_main_avro_to_pydantic(mock_convert_file): | ||
# Call the main function with test arguments | ||
test_args = ["avro_to_pydantic", "--asvc", "test.avsc", "--output", "output.py"] | ||
main_module.main(test_args) | ||
|
||
# Assert that convert_file was called with the correct arguments | ||
mock_convert_file.assert_called_once_with("test.avsc", "output.py") | ||
|
||
|
||
@patch.object(main_module, "main") | ||
@patch.object( | ||
main_module.sys, "argv", ["__main__.py", "avro_to_pydantic", "--asvc", "test.avsc", "--output", "output.py"] | ||
) | ||
def test_root_main(mock_main): | ||
# Call the root_main function | ||
main_module.root_main() | ||
|
||
# Assert that main was called with the correct arguments | ||
mock_main.assert_called_once_with(["avro_to_pydantic", "--asvc", "test.avsc", "--output", "output.py"]) |