diff --git a/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/odoo_specific_hooks/check_view_name_test.py b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/odoo_specific_hooks/check_view_name_test.py new file mode 100644 index 0000000..87c0e27 --- /dev/null +++ b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/odoo_specific_hooks/check_view_name_test.py @@ -0,0 +1,25 @@ +import sys + +import pytest + +from pre_commit_hooks.loaderon_hooks.odoo_specific_hooks.check_view_name import main +from pre_commit_hooks.loaderon_hooks.tests.automatic_testing.util.test_helpers import \ + perform_test_on_file_expecting_result + + +@pytest.fixture(autouse=True) +def clean_sys_argv(): + sys.argv = [] + yield + + +def test_check_view_name_ok(): + perform_test_on_file_expecting_result('check_view_name_samples/ok.xml', main) + + +def test_check_view_name_inherit_ok(): + perform_test_on_file_expecting_result('check_view_name_samples/inherit_ok.xml', main) + + +def test_check_view_name_error(): + perform_test_on_file_expecting_result('check_view_name_samples/error.xml', main, expected_result=2) diff --git a/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/__init__.py b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/error.xml b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/error.xml new file mode 100644 index 0000000..196f950 --- /dev/null +++ b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/error.xml @@ -0,0 +1,9 @@ + + bad_name + model_name + + + + + + \ No newline at end of file diff --git a/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/inherit_ok.xml b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/inherit_ok.xml new file mode 100644 index 0000000..a5dacb3 --- /dev/null +++ b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/inherit_ok.xml @@ -0,0 +1,9 @@ + + model_name.search.inherit + model_name + + + + + + \ No newline at end of file diff --git a/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/ok.xml b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/ok.xml new file mode 100644 index 0000000..53cb29c --- /dev/null +++ b/pre_commit_hooks/loaderon_hooks/tests/automatic_testing/testing_samples/check_view_name_samples/ok.xml @@ -0,0 +1,9 @@ + + model_name.search + model_name + + + + + + \ No newline at end of file