-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat intent threads as new based on gate.status. (#4558)
- Loading branch information
Showing
2 changed files
with
19 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -426,15 +426,20 @@ def test_is_lgtm_allowed__other(self, mock_get_approvers): | |
self.assertFalse(detect_intent.is_lgtm_allowed( | ||
'[email protected]', self.feature_1, approval_defs.ShipApproval)) | ||
|
||
def test_detect_new_thread__no_votes(self): | ||
"""New thread is detected when if no votes exist for a given gate.""" | ||
def test_detect_new_thread__no_gate_activity(self): | ||
"""New thread is detected when its gate is still PREPARING.""" | ||
self.assertTrue(detect_intent.detect_new_thread( | ||
self.gate_1.key.integer_id())) | ||
Gate(id=301, feature_id=1, stage_id=20, gate_type=3, | ||
state=Gate.PREPARING))) | ||
|
||
def test_detect_new_thread__existing_votes(self): | ||
"""Existing thread is detected when if votes exist for a given gate.""" | ||
def test_detect_new_thread__gate_was_updated(self): | ||
"""Existing thread is detected when its gate has already changed state.""" | ||
self.assertFalse(detect_intent.detect_new_thread( | ||
self.gate_2.key.integer_id())) | ||
Gate(id=302, feature_id=1, stage_id=20, gate_type=3, | ||
state=Vote.REVIEW_REQUESTED))) | ||
self.assertFalse(detect_intent.detect_new_thread( | ||
Gate(id=303, feature_id=1, stage_id=20, gate_type=3, | ||
state=Vote.REVIEW_STARTED))) | ||
|
||
|
||
class IntentEmailHandlerTest(testing_config.CustomTestCase): | ||
|
@@ -456,13 +461,13 @@ def setUp(self): | |
for gate_type in gate_types: | ||
gate = Gate(feature_id=self.feature_id, | ||
stage_id=stage.key.integer_id(), gate_type=gate_type, | ||
state=Vote.NA) | ||
state=Gate.PREPARING) | ||
gate.put() | ||
extra_extension_stage = Stage(feature_id=self.feature_id, stage_type=151) | ||
extra_extension_stage.put() | ||
extra_extension_gate = Gate(feature_id=self.feature_id, | ||
stage_id=extra_extension_stage.key.integer_id(), | ||
gate_type=3, state=Vote.NA) | ||
gate_type=3, state=Gate.PREPARING) | ||
extra_extension_gate.put() | ||
self.stages_dict = stage_helpers.get_feature_stages(self.feature_id) | ||
# The intent thread url already exists for the first extension stage. | ||
|
@@ -472,11 +477,11 @@ def setUp(self): | |
self.stage_1 = self.stages_dict[151][0] | ||
self.gate_1 = Gate( | ||
feature_id=self.feature_id, stage_id=self.stage_1.key.integer_id(), | ||
gate_type=3, state=Vote.NA) | ||
gate_type=3, state=Gate.PREPARING) | ||
self.gate_1.put() | ||
self.gate_with_experiment_type = Gate( | ||
feature_id=self.feature_id, stage_id=self.stage_1.key.integer_id(), | ||
gate_type=2, state=Vote.NA) | ||
gate_type=2, state=Gate.PREPARING) | ||
self.gate_with_experiment_type.put() | ||
|
||
self.request_path = '/tasks/detect-intent' | ||
|