|
| 1 | +import release_notes |
| 2 | + |
| 3 | + |
| 4 | +def test_is_dependabot_pr_detects_dependabot_author(): |
| 5 | + pr = { |
| 6 | + "author": {"is_bot": True, "login": "app/dependabot"}, |
| 7 | + "labels": [ |
| 8 | + {"name": "dependencies"}, |
| 9 | + {"name": "github_actions"}, |
| 10 | + ], |
| 11 | + } |
| 12 | + |
| 13 | + assert release_notes.is_dependabot_pr(pr) |
| 14 | + |
| 15 | + pr = { |
| 16 | + "author": {"is_bot": True, "login": "app/notdependabot"}, |
| 17 | + "labels": [ |
| 18 | + {"name": "dependencies"}, |
| 19 | + {"name": "github_actions"}, |
| 20 | + ], |
| 21 | + } |
| 22 | + |
| 23 | + assert release_notes.is_dependabot_pr(pr) |
| 24 | + |
| 25 | + pr = { |
| 26 | + "author": {"is_bot": False, "login": "app/dependabot"}, |
| 27 | + "labels": [ |
| 28 | + {"name": "dependencies"}, |
| 29 | + {"name": "github_actions"}, |
| 30 | + ], |
| 31 | + } |
| 32 | + |
| 33 | + assert release_notes.is_dependabot_pr(pr) |
| 34 | + |
| 35 | + pr = { |
| 36 | + "author": {"is_bot": False, "login": "app/notdependabot"}, |
| 37 | + "labels": [ |
| 38 | + {"name": "dependencies"}, |
| 39 | + {"name": "github_actions"}, |
| 40 | + ], |
| 41 | + } |
| 42 | + |
| 43 | + assert not release_notes.is_dependabot_pr(pr) |
| 44 | + |
| 45 | + pr = { |
| 46 | + "author": {"is_bot": False, "login": "app/dependabot"}, |
| 47 | + "labels": [ |
| 48 | + {"name": "github_actions"}, |
| 49 | + ], |
| 50 | + } |
| 51 | + |
| 52 | + assert release_notes.is_dependabot_pr(pr) |
| 53 | + |
| 54 | + pr = { |
| 55 | + "author": {"is_bot": False, "login": "app/notdependabot"}, |
| 56 | + "labels": [ |
| 57 | + {"name": "github_actions"}, |
| 58 | + ], |
| 59 | + } |
| 60 | + |
| 61 | + assert not release_notes.is_dependabot_pr(pr) |
| 62 | + |
| 63 | + pr = { |
| 64 | + "author": {"is_bot": True, "login": "app/notdependabot"}, |
| 65 | + "labels": [ |
| 66 | + {"name": "github_actions"}, |
| 67 | + ], |
| 68 | + } |
| 69 | + |
| 70 | + assert not release_notes.is_dependabot_pr(pr) |
| 71 | + |
| 72 | + pr = { |
| 73 | + "author": {"is_bot": False, "login": "dependabot[bot]"}, |
| 74 | + "labels": [ |
| 75 | + {"name": "github_actions"}, |
| 76 | + ], |
| 77 | + } |
| 78 | + |
| 79 | + assert release_notes.is_dependabot_pr(pr) |
| 80 | + |
| 81 | + pr = { |
| 82 | + "author": {"login": "dependabot[bot]"}, |
| 83 | + "labels": [ |
| 84 | + {"name": "github_actions"}, |
| 85 | + ], |
| 86 | + } |
| 87 | + |
| 88 | + assert release_notes.is_dependabot_pr(pr) |
| 89 | + |
| 90 | + pr = { |
| 91 | + "author": {"login": "app/notdependabot"}, |
| 92 | + "labels": [ |
| 93 | + {"name": "github_actions"}, |
| 94 | + ], |
| 95 | + } |
| 96 | + |
| 97 | + assert not release_notes.is_dependabot_pr(pr) |
| 98 | + |
| 99 | + pr = { |
| 100 | + "author": {"login": "app/notdependabot"}, |
| 101 | + "labels": [ |
| 102 | + {"name": "dependencies"}, |
| 103 | + {"name": "github_actions"}, |
| 104 | + ], |
| 105 | + } |
| 106 | + |
| 107 | + assert not release_notes.is_dependabot_pr(pr) |
0 commit comments