Skip to content

Commit

Permalink
Add test to improve coverage and robustify
Browse files Browse the repository at this point in the history
  • Loading branch information
louck committed Oct 24, 2024
1 parent 14a3924 commit e963c04
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions commown_b2b_mail_channel/tests/test_res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,32 @@ def test_set_support_channel_name(self):
self.company.mail_channel_id.name,
"Support %s" % new_name,
)

def test_partner_are_unsubscribed_when_company_is_changed(self):
company_2 = self.company.copy()

self.part1.parent_id = self.company
self.part2.parent_id = company_2

self.company.create_mail_channel()
mail_channel = self.company.mail_channel_id

self.assertIn(
self.part1,
mail_channel.mapped("channel_last_seen_partner_ids.partner_id"),
)
self.assertNotIn(
self.part2,
mail_channel.mapped("channel_last_seen_partner_ids.partner_id"),
)

mail_channel.company_id = company_2
self.assertEquals(mail_channel.company_id, mail_channel.company_ids)
self.assertIn(
self.part2,
mail_channel.mapped("channel_last_seen_partner_ids.partner_id"),
)
self.assertNotIn(
self.part1,
mail_channel.mapped("channel_last_seen_partner_ids.partner_id"),
)

0 comments on commit e963c04

Please sign in to comment.