|
| 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 | + |
| 11 | + "text": "Initial comment", |
| 12 | + }, |
| 13 | + { |
| 14 | + "creation_time": datetime(2023, 10, 1, 11, 0), |
| 15 | + |
| 16 | + "text": "Bot comment", |
| 17 | + }, |
| 18 | + { |
| 19 | + "creation_time": datetime(2023, 10, 1, 12, 0), |
| 20 | + |
| 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