|
4 | 4 | import pytest
|
5 | 5 | import requests
|
6 | 6 | import responses
|
| 7 | +import tests.fixtures.factories as factories |
7 | 8 |
|
8 | 9 | from jbi import Operation
|
9 | 10 | from jbi.bugzilla.client import BugNotAccessibleError
|
@@ -624,6 +625,35 @@ def test_lookup_action_found(whiteboard, actions, bug_factory):
|
624 | 625 | assert "test config" in action.description
|
625 | 626 |
|
626 | 627 |
|
| 628 | +@pytest.mark.parametrize( |
| 629 | + "whiteboard,expected_tags", |
| 630 | + [ |
| 631 | + ("[example][DevTest]", ["devtest"]), |
| 632 | + ("[DevTest][example]", ["devtest"]), |
| 633 | + ("[example][DevTest][other]", ["devtest", "other"]), |
| 634 | + ], |
| 635 | +) |
| 636 | +def test_multiple_lookup_actions_found(whiteboard, expected_tags, bug_factory): |
| 637 | + actions = factories.ActionsFactory(root=[ |
| 638 | + factories.ActionFactory( |
| 639 | + whiteboard_tag="devtest", |
| 640 | + bugzilla_user_id="tbd", |
| 641 | + description="test config", |
| 642 | + ), |
| 643 | + factories.ActionFactory( |
| 644 | + whiteboard_tag="other", |
| 645 | + bugzilla_user_id="tbd", |
| 646 | + description="test config", |
| 647 | + ), |
| 648 | + ]) |
| 649 | + bug = bug_factory(id=1234, whiteboard=whiteboard) |
| 650 | + acts = lookup_actions(bug, actions) |
| 651 | + assert len(acts) == len(expected_tags) |
| 652 | + looked_up_tags = [a.whiteboard_tag for a in acts] |
| 653 | + assert sorted(looked_up_tags) == sorted(expected_tags) |
| 654 | + assert all(["test config" == a.description for a in acts]) |
| 655 | + |
| 656 | + |
627 | 657 | @pytest.mark.parametrize(
|
628 | 658 | "whiteboard",
|
629 | 659 | [
|
|
0 commit comments