Skip to content

Commit

Permalink
fixup! [ADD] eater: tests
Browse files Browse the repository at this point in the history
Signed-off-by: Carmen Bianca BAKKER <[email protected]>
  • Loading branch information
carmenbianca committed Oct 9, 2023
1 parent 7e27129 commit 3d7f339
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions eater/demo/eaters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,20 @@
<field name="eater">eater</field>
<field name="is_company" eval="False" />
</record>

<record id="worker1" model="res.partner">
<field name="name">Gijs Eaterdam</field>
<field name="firstname">Gijs</field>
<field name="lastname">Eaterdam</field>
<field name="eater">worker_eater</field>
<field name="is_company" eval="False" />
</record>

<record id="worker2" model="res.partner">
<field name="name">Arkhan Fane-Eater</field>
<field name="firstname">Arkhan</field>
<field name="lastname">Fane-Eater</field>
<field name="eater">worker_eater</field>
<field name="is_company" eval="False" />
</record>
</odoo>
6 changes: 3 additions & 3 deletions eater/tests/test_eater.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ class TestEater(TransactionCase):
def test_assign_parent_eater(self):
self.assertTrue(
self.env.ref("eater.eater2").write(
{"parent_eater_id": self.env.ref("eater.eater1")}
{"parent_eater_id": self.env.ref("eater.worker1").id}
)
)

def test_eater_already_has_another_parent(self):
self.env.ref("eater.eater2").write(
{"parent_eater_id": self.env.ref("eater.eater1")}
{"parent_eater_id": self.env.ref("eater.worker1").id}
)
with self.assertRaises(ValidationError):
self.env.ref("eater.eater2").write(
{"parent_eater_id": self.env.ref("eater.eater3")}
{"parent_eater_id": self.env.ref("eater.worker2").id}
)

0 comments on commit 3d7f339

Please sign in to comment.