6262 CinderAppeal ,
6363 CinderJob ,
6464 CinderPolicy ,
65- CinderQueueMove ,
6665 ContentDecision ,
6766)
6867
@@ -777,8 +776,11 @@ def test_reviewer_handled(self):
777776 assert list (qs ) == [job , appeal_job ]
778777
779778 not_policy_report .cinder_job .update (resolvable_in_reviewer_tools = True )
780- CinderQueueMove .objects .create (
781- cinder_job = not_policy_report .cinder_job , to_queue = '?'
779+ ContentDecision .objects .create (
780+ action = DECISION_ACTIONS .AMO_ESCALATE_ADDON ,
781+ action_date = datetime .now (),
782+ cinder_job = not_policy_report .cinder_job ,
783+ addon = not_policy_report .target ,
782784 )
783785 qs = CinderJob .objects .resolvable_in_reviewer_tools ()
784786 assert list (qs ) == [not_policy_report .cinder_job , job , appeal_job ]
@@ -1401,9 +1403,10 @@ def test_process_queue_move_into_reviewer_handled(self):
14011403 nhr = NeedsHumanReview .objects .get ()
14021404 assert nhr .reason == NeedsHumanReview .REASONS .CINDER_ESCALATION
14031405 assert nhr .version == addon .current_version
1404- assert CinderQueueMove .objects .filter (
1405- cinder_job = cinder_job , to_queue = 'amo-env-addon-infringement' , notes = 'notes!'
1406- ).exists ()
1406+ assert cinder_job .decision .private_notes == 'notes!'
1407+ assert cinder_job .decision .action == DECISION_ACTIONS .AMO_ESCALATE_ADDON
1408+ assert cinder_job .decision .cinder_job == cinder_job
1409+ assert cinder_job .decision .addon == cinder_job .target_addon
14071410
14081411 def test_process_queue_move_out_of_reviewer_handled (self ):
14091412 # Not yet implemented, so just check it's silently ignored
@@ -1421,9 +1424,7 @@ def test_process_queue_move_out_of_reviewer_handled(self):
14211424 assert cinder_job .resolvable_in_reviewer_tools is True
14221425 assert len (mail .outbox ) == 0
14231426 assert NeedsHumanReview .objects .count () == 1
1424- assert CinderQueueMove .objects .filter (
1425- cinder_job = cinder_job , to_queue = 'amo-env-listings' , notes = 'out'
1426- ).exists ()
1427+ assert not cinder_job .decision
14271428
14281429 def test_process_queue_move_other_queue_movement (self ):
14291430 # we don't need to about these other queue moves, so just check it's silently
@@ -1436,9 +1437,7 @@ def test_process_queue_move_other_queue_movement(self):
14361437 assert not cinder_job .resolvable_in_reviewer_tools
14371438 assert len (mail .outbox ) == 0
14381439 assert NeedsHumanReview .objects .count () == 0
1439- assert CinderQueueMove .objects .filter (
1440- cinder_job = cinder_job , to_queue = 'amo-env-some-other-queue' , notes = '?'
1441- ).exists ()
1440+ assert not cinder_job .decision
14421441
14431442 @override_switch ('dsa-cinder-forwarded-review' , active = True )
14441443 def test_process_queue_move_with_addon_already_moderated (self ):
@@ -1476,7 +1475,11 @@ def test_process_queue_move_with_addon_already_moderated(self):
14761475 assert mail .outbox [0 ].to == ['some@email.com' ]
14771476 assert 'already assessed' in mail .outbox [0 ].body
14781477 assert ContentDecision .objects .exists ()
1479- decision = ContentDecision .objects .get ()
1478+ assert ContentDecision .objects .count () == 2
1479+ assert ContentDecision .objects .first ().action == (
1480+ DECISION_ACTIONS .AMO_ESCALATE_ADDON
1481+ )
1482+ decision = ContentDecision .objects .last ()
14801483 assert decision .action == DECISION_ACTIONS .AMO_CLOSED_NO_ACTION
14811484 self .assertCloseToNow (decision .action_date )
14821485 assert decision .cinder_job == CinderJob .objects .get ()
@@ -1612,14 +1615,24 @@ def test_clear_needs_human_review_flags_abuse(self):
16121615 def test_clear_needs_human_review_flags_forwarded_moved_queue (self ):
16131616 job = self ._setup_clear_needs_human_review_flags ()
16141617 # if the job is forwarded, we make sure that there are no other forwarded jobs
1615- CinderQueueMove .objects .create (cinder_job = job , to_queue = 'wherever' )
1618+ job .decision .update (action = DECISION_ACTIONS .AMO_ESCALATE_ADDON )
1619+ ContentDecision .objects .create (
1620+ action = DECISION_ACTIONS .AMO_APPROVE ,
1621+ addon = job .target_addon ,
1622+ cinder_job = job ,
1623+ override_of = job .final_decision ,
1624+ )
16161625
16171626 other_forward = CinderJob .objects .create (
16181627 job_id = '3' ,
16191628 target_addon = job .target_addon ,
16201629 resolvable_in_reviewer_tools = True ,
16211630 )
1622- CinderQueueMove .objects .create (cinder_job = other_forward , to_queue = 'whoever' )
1631+ ContentDecision .objects .create (
1632+ action = DECISION_ACTIONS .AMO_ESCALATE_ADDON ,
1633+ addon = job .target_addon ,
1634+ cinder_job = other_forward ,
1635+ )
16231636 job .clear_needs_human_review_flags ()
16241637 assert self ._nhr_exists (NeedsHumanReview .REASONS .ABUSE_ADDON_VIOLATION )
16251638 assert self ._nhr_exists (NeedsHumanReview .REASONS .CINDER_ESCALATION )
@@ -1632,6 +1645,7 @@ def test_clear_needs_human_review_flags_forwarded_moved_queue(self):
16321645 action = DECISION_ACTIONS .AMO_APPROVE ,
16331646 addon = job .target_addon ,
16341647 cinder_job = other_forward ,
1648+ override_of = other_forward .decision ,
16351649 )
16361650 job .clear_needs_human_review_flags ()
16371651 assert self ._nhr_exists (NeedsHumanReview .REASONS .ABUSE_ADDON_VIOLATION )
@@ -3507,17 +3521,24 @@ def test_send_notifications_without_notifying_owners(self):
35073521 def test_resolve_job_forwarded (self ):
35083522 addon_developer = user_factory ()
35093523 addon = addon_factory (users = [addon_developer ])
3524+ cinder_job = CinderJob .objects .create (job_id = '999' )
3525+ ContentDecision .objects .create (
3526+ addon = addon ,
3527+ action = DECISION_ACTIONS .AMO_ESCALATE_ADDON ,
3528+ action_date = datetime .now (),
3529+ private_notes = 'why moved' ,
3530+ cinder_job = cinder_job ,
3531+ )
35103532 decision = ContentDecision .objects .create (
35113533 addon = addon ,
35123534 action = DECISION_ACTIONS .AMO_REJECT_VERSION_ADDON ,
35133535 action_date = datetime .now (),
35143536 reasoning = 'some review text' ,
35153537 reviewer_user = self .reviewer_user ,
3538+ cinder_job = cinder_job ,
35163539 )
35173540 policies = [CinderPolicy .objects .create (name = 'policy' , uuid = '12345678' )]
35183541 decision .policies .set (policies )
3519- cinder_job = CinderJob .objects .create (job_id = '999' , decision = decision )
3520- CinderQueueMove .objects .create (cinder_job = cinder_job , to_queue = 'wherever' )
35213542 NeedsHumanReview .objects .create (
35223543 version = addon .current_version ,
35233544 reason = NeedsHumanReview .REASONS .CINDER_ESCALATION ,
@@ -3563,14 +3584,20 @@ def test_resolve_job_forwarded(self):
35633584 def test_execute_action_forwarded_to_legal (self ):
35643585 addon_developer = user_factory ()
35653586 addon = addon_factory (users = [addon_developer ])
3587+ cinder_job = CinderJob .objects .create (job_id = '999' )
3588+ ContentDecision .objects .create (
3589+ addon = addon ,
3590+ action = DECISION_ACTIONS .AMO_ESCALATE_ADDON ,
3591+ private_notes = 'why moved' ,
3592+ cinder_job = cinder_job ,
3593+ )
35663594 decision = ContentDecision .objects .create (
35673595 addon = addon ,
35683596 action = DECISION_ACTIONS .AMO_LEGAL_FORWARD ,
35693597 reasoning = 'some reasoning' ,
35703598 reviewer_user = self .reviewer_user ,
3599+ cinder_job = cinder_job ,
35713600 )
3572- cinder_job = CinderJob .objects .create (job_id = '999' , decision = decision )
3573- CinderQueueMove .objects .create (cinder_job = cinder_job , to_queue = 'wherever' )
35743601 NeedsHumanReview .objects .create (
35753602 version = addon .current_version ,
35763603 reason = NeedsHumanReview .REASONS .CINDER_ESCALATION ,
0 commit comments