Skip to content

Commit

Permalink
fixup! [12.0][IMP] base_tier_validation_forward, allow backward tier
Browse files Browse the repository at this point in the history
  • Loading branch information
HviorForgeFlow committed Nov 8, 2022
1 parent a560533 commit 025c233
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions base_tier_validation_forward/tests/test_tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,23 @@ def test_02_forward_tier_backward(self):
}
)
# Request validation
review = test_record.with_user(self.test_user_2.id).request_validation()
review = test_record.sudo(user=self.test_user_2.id).request_validation()
self.assertTrue(review)
record = test_record.with_user(self.test_user_1.id)
record = test_record.sudo(user=self.test_user_1.id)
record.invalidate_cache()
record.validate_tier()
self.assertFalse(record.can_forward)
self.assertFalse(record.can_backward)
# User 2 forward to user 1
record = test_record.with_user(self.test_user_2.id)
record = test_record.sudo(user=self.test_user_2.id)
record.invalidate_cache()
self.assertTrue(record.can_forward)
self.assertTrue(record.can_backward)
res = record.forward_tier()
ctx = res.get("context")
wizard = Form(
self.env["tier.validation.forward.wizard"]
.with_user(self.test_user_2.id)
.sudo(user=self.test_user_2.id)
.with_context(ctx)
)
wizard.forward_reviewer_id = self.test_user_1
Expand All @@ -160,22 +160,22 @@ def test_02_forward_tier_backward(self):
wiz = wizard.save()
wiz.add_forward()
# Newly created forwarded review will have no definition and will have origin
record = test_record.with_user(self.test_user_2.id)
record = test_record.sudo(user=self.test_user_2.id)
record.invalidate_cache()
self.assertTrue(record.review_ids.filtered(lambda l: not l.definition_id))
self.assertTrue(record.review_ids.filtered(lambda l: l.origin_id))
# User 1 validate
res = record.with_user(self.test_user_1.id).validate_tier()
res = record.sudo(user=self.test_user_1.id).validate_tier()
ctx = res.get("context")
wizard = Form(
self.env["comment.wizard"].with_user(self.test_user_1.id).with_context(ctx)
self.env["comment.wizard"].sudo(user=self.test_user_1.id).with_context(ctx)
)
wizard.comment = "Forward tier is reviewed"
wiz = wizard.save()
wiz.add_comment()
self.assertFalse(record.validated)
# Newly created review back to the original user
record = test_record.with_user(self.test_user_2.id)
record = test_record.sudo(user=self.test_user_2.id)
record.invalidate_cache()
# There are now two tier reviews for user 2
self.assertEqual(
Expand Down

0 comments on commit 025c233

Please sign in to comment.