Skip to content

Commit 38f59dc

Browse files
authored
Add test for perfalert resolved (#2625)
1 parent b097c3d commit 38f59dc

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
def test_get_resolution_comment():
2+
from datetime import datetime
3+
4+
from bugbot.rules.perfalert_resolved_regression import PerfAlertResolvedRegression
5+
6+
# Mock data
7+
comments = [
8+
{
9+
"creation_time": datetime(2023, 10, 1, 10, 0),
10+
"author": "[email protected]",
11+
"text": "Initial comment",
12+
},
13+
{
14+
"creation_time": datetime(2023, 10, 1, 11, 0),
15+
"author": "[email protected]",
16+
"text": "Bot comment",
17+
},
18+
{
19+
"creation_time": datetime(2023, 10, 1, 12, 0),
20+
"author": "[email protected]",
21+
"text": "Resolution comment",
22+
},
23+
]
24+
bug_history = {
25+
"status_time": datetime(2023, 10, 1, 12, 0),
26+
"status_author": "[email protected]",
27+
}
28+
29+
# Instantiate the class
30+
perf_alert = PerfAlertResolvedRegression()
31+
32+
# Test the method
33+
resolution_comment = perf_alert.get_resolution_comment(comments, bug_history)
34+
35+
# Assert the expected outcome
36+
assert resolution_comment == "Resolution comment"

0 commit comments

Comments
 (0)