Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit 92f1d27

Browse files
committed
Add a test
1 parent 71fdcce commit 92f1d27

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

highfive/tests/fakes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ def get_repo_configs():
6565
"reviewers": ["@pnkfelix"],
6666
}
6767
}
68+
},
69+
'mentions_without_dirs': {
70+
"groups": {"all": ["@JohnTitor"]},
71+
"dirs": {},
72+
"mentions": {
73+
"README.md": {
74+
"message": "should be pinged",
75+
"reviewers": ["@JohnTitor"],
76+
}
77+
}
6878
}
6979
}
7080

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/README.md b/README.md
2+
index 5ec94e189f8..b35fbba3fcd 100644
3+
--- a/README.md
4+
+++ b/README.md
5+
@@ -1,6 +1,6 @@
6+
# The Rust Programming Language
7+
8+
-This is the main source code repository for [Rust]. It contains the compiler,
9+
+Hey! This is the main source code repository for [Rust]. It contains the compiler,
10+
standard library, and documentation.
11+
12+
[Rust]: https://www.rust-lang.org

highfive/tests/test_newpr.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ def make_fakes(cls):
10331033
'normal': load_fake('normal.diff'),
10341034
'travis-yml': load_fake('travis-yml.diff'),
10351035
'mentions': load_fake('mentions.diff'),
1036+
'mentions-without-dirs': load_fake('mentions-without-dirs.diff'),
10361037
},
10371038
'config': fakes.get_repo_configs(),
10381039
'global_': fakes.get_global_configs(),
@@ -1206,6 +1207,15 @@ def test_mentions(self):
12061207
# @ehuss should not be listed here
12071208
assert set(["@pnkfelix", "@GuillaumeGomez"]) == mentions
12081209

1210+
def test_mentions_without_dirs(self):
1211+
"""Test pinging people even if the dirs key is empty."""
1212+
self.handler = HighfiveHandlerMock(
1213+
Payload({}), repo_config=self.fakes['config']['mentions_without_dirs']
1214+
).handler
1215+
(chosen_reviewers, mentions) = self.choose_reviewers(
1216+
self.fakes['diff']['mentions-without-dirs'], "@JohnTitor",
1217+
)
1218+
assert set(["@JohnTitor"]) == mentions
12091219

12101220
class TestRun(TestNewPR):
12111221
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)