mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
hook tests ready
This commit is contained in:
parent
5aeb09a3b5
commit
553a2679e6
5 changed files with 52 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<record id="an_id" model="ir.ui.view">
|
||||
<field name="name">bad_name</field>
|
||||
<field name="model">model_name</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Some search conf">
|
||||
<field name="some_field"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<record id="an_id" model="ir.ui.view">
|
||||
<field name="name">model_name.search.inherit</field>
|
||||
<field name="model">model_name</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Some search conf">
|
||||
<field name="some_field"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<record id="an_id" model="ir.ui.view">
|
||||
<field name="name">model_name.search</field>
|
||||
<field name="model">model_name</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Some search conf">
|
||||
<field name="some_field"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
Loading…
Add table
Add a link
Reference in a new issue